HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/setuptools/config/__pycache__/pyprojecttoml.cpython-37.pyc
B

N��g�C�@svdZddlZddlZddlmZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZddlmZmZddlmZd	d
lmZd	dlmZmZd	dlmZer�dd
lmZeeejfZ e�!e"�Z#e e$d�dd�Z%e$e e&d�dd�Z'd+de dd�dd�Z(d,e edd�dd�Z)d-e$ee e&ede$d�dd�Z*Gd d!�d!�Z+d"d#�Z,ee&d$�d%d&��Z-Gd'd(�d(ej.�Z/Gd)d*�d*e�Z0dS).ac
Load setuptools configuration from ``pyproject.toml`` files.

**PRIVATE MODULE**: API reserved for setuptools internal usage only.

To read project metadata, consider using
``build.util.project_wheel_metadata`` (https://pypi.org/project/build/).
For simple scenarios, you can also try parsing the file directly
with the help of ``tomllib`` or ``tomli``.
�N)�contextmanager)�partial)�
TYPE_CHECKING�Callable�Dict�Mapping�Optional�Set�Union�)�	FileError�OptionError)�SetuptoolsWarning�)�expand)�_PREVIOUSLY_DEFINED�_WouldIgnoreField)�apply)�Distribution)�filepath�returnc	Cs,ddlm}t|d��}|�|�SQRXdS)Nr)�tomli�rb)Zsetuptools.externr�open�load)rr�file�r�C/tmp/pip-unpacked-wheel-yrlplx0q/setuptools/config/pyprojecttoml.py�	load_filesr)�configrrc
Cs�ddlm}|j�d�}t|d�r*|��y
|�|�S|jk
r�}zXd|j��}|j	�
d�dkrzt�|�t�|j
�d|j	�d	�}t|�d
|���d�Wdd}~XYnXdS)Nr)�_validate_pyprojectztrove-classifier�_disable_downloadzconfiguration error: �`�projectzinvalid pyproject.toml config: �.�
)�r ZFORMAT_FUNCTIONS�get�hasattrr!�validateZValidationError�summary�name�strip�_logger�debug�details�
ValueError)rrZ	validatorZtrove_classifier�exr*�errorrrrr)%s


r)Fr)�distrrcCst|d||�}t|||�S)zeApply the configuration from a ``pyproject.toml`` file into an existing
    distribution object.
    T)�read_configuration�_apply)r3r�ignore_option_errorsrrrr�apply_configuration:sr7T)rr3c
	Cstj�|�}tj�|�s(td|�d���t|�p2i}|�di�}|�di�}|�di�}|rd|sh|shiS|rtt��|r�t	|dd�dk	r�|�
d|j�n|�
dd	�||d<||d<t|��|d|id
�}t
||�WdQRX|r�tj�|�}	t||	||�S|S)a�Read given configuration file and returns options from it as a dict.

    :param str|unicode filepath: Path to configuration file in the ``pyproject.toml``
        format.

    :param bool expand: Whether to expand directives and other computed values
        (i.e. post-process the given configuration)

    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.

    :param Distribution|None: Distribution object to which the configuration refers.
        If not given a dummy object will be created and discarded after the
        configuration is read. This is used for auto-discovery of packages and in the
        case a dynamic configuration (e.g. ``attr`` or ``cmdclass``) is expanded.
        When ``expand=False`` this object is simply ignored.

    :rtype: dict
    zConfiguration file z does not exist.r#�tool�
setuptools�include_package_dataNzinclude-package-dataT)r#r8)�os�path�abspath�isfilerrr'�_BetaConfiguration�emit�getattr�
setdefaultr:�_ignore_errorsr)�dirname�expand_configuration)
rrr6r3ZasdictZ
project_tableZ
tool_tableZsetuptools_tableZsubset�root_dirrrrr4Fs.
r4)rrFr6r3rcCst||||���S)a�Given a configuration with unresolved fields (e.g. dynamic, cmdclass, ...)
    find their final values.

    :param dict config: Dict containing the configuration for the distribution
    :param str root_dir: Top-level directory for the distribution/project
        (the same directory where ``pyproject.toml`` is place)
    :param bool ignore_option_errors: see :func:`read_configuration`
    :param Distribution|None: Distribution object to which the configuration refers.
        If not given a dummy object will be created and discarded after the
        configuration is read. Used in the case a dynamic configuration
        (e.g. ``attr`` or ``cmdclass``).

    :rtype: dict
    )�_ConfigExpanderr)rrFr6r3rrrrE�srEc@s`eZdZd4eeeeedd�dd�Zdd�dd	�Zee	e
d
�dd�Zd5dd�Zdd�Z
dd�Zdd�Zee	e	fd�dd�Zdee	e	fd�dd�Zde	d�dd�Ze	ee	e	fd�d d!�Zde	ee	e	fd"�d#d$�Zdee	e	fd�d%d&�Zdeee	e	fd'�d(d)�Zdee	e	feee	efd*�d+d,�Zdd-�d.d/�Zdd-�d0d1�Zdd-�d2d3�ZdS)6rGNFr)rrFr6r3cCsp||_|pt��|_|�di�|_|j�dg�|_|�di��di�|_|j�di�|_||_	||_
t�|_dS)Nr#�dynamicr8r9)
rr;�getcwdrFr'�project_cfgrH�setuptools_cfg�dynamic_cfgr6�_dist�set�_referenced_files)�selfrrFr6r3rrr�__init__�sz_ConfigExpander.__init__)rcCs0ddlm}|j|j�dd�d�}|jp.||�S)Nr)rr+)Zsrc_rootr+)�setuptools.distrrFrJr'rM)rPr�attrsrrr�_ensure_dist�sz_ConfigExpander._ensure_dist)�	container�field�fnc	Cs2||kr.t|j��|||�||<WdQRXdS)N)rCr6)rPrUrVrWrrr�_process_field�sz_ConfigExpander._process_field�package-datacCs|j�|i�}t�|�S)N)rKr'�_expandZcanonic_package_data)rPrV�package_datarrr�_canonic_package_data�sz%_ConfigExpander._canonic_package_datac	Csz|��|��|�d�|��}t||j|j�}|�*}|j}|��|�|�|�	||�WdQRX|j
�|j
�|jS)Nzexclude-package-data)
�_expand_packagesr\rT�_EnsurePackagesDiscoveredrJrK�package_dir�_expand_data_files�_expand_cmdclass�_expand_all_dynamicrO�updater)rPr3�ctxZensure_discoveredr_rrrr�s

z_ConfigExpander.expandc	Cs�|j�d�}|dks"t|ttf�r&dS|�d�}t|t�r~|j|d<|j�di�|d<t|j	��t
jf|�|jd<WdQRXdS)N�packages�findrFzpackage-dirZfill_package_dir)rKr'�
isinstance�list�tuple�dictrFrBrCr6rZZ
find_packages)rPrerfrrrr]�s


z _ConfigExpander._expand_packagescCs$ttj|jd�}|�|jd|�dS)N)rFz
data-files)rrZZcanonic_data_filesrFrXrK)rP�
data_filesrrrr`�sz"_ConfigExpander._expand_data_files)r_cCs*|j}ttj||d�}|�|jd|�dS)N)r_rF�cmdclass)rFrrZrlrXrK)rPr_rFrlrrrra�sz _ConfigExpander._expand_cmdclass)r3r_c	s�d�����fdd��jD�}|j�����p0i���������������������d�dd�|��D�}�j	�|�dS)N)�version�readmezentry-points�scriptszgui-scripts�classifiers�dependencieszoptional-dependenciescs$i|]}|�kr���|��|�qSr)�_obtain)�.0rV)r3r_rP�specialrr�
<dictcomp>�sz7_ConfigExpander._expand_all_dynamic.<locals>.<dictcomp>)rmrnrprqZoptional_dependenciescSsi|]\}}|dk	r||�qS)Nr)rs�k�vrrrrus)
rHrc�_obtain_entry_points�_obtain_version�_obtain_readme�_obtain_classifiers�_obtain_dependencies�_obtain_optional_dependencies�itemsrJ)rPr3r_Zobtained_dynamicZupdatesr)r3r_rPrtrrb�s


z#_ConfigExpander._expand_all_dynamic)r3rVcCs2t||�}|dkr.|js.d|�d�}t|��dS)Nz#No configuration found for dynamic z�.
Some dynamic fields need to be specified via `tool.setuptools.dynamic`
others must be specified via the equivalent attribute in `setup.py`.)rr6r
)rPr3rV�previous�msgrrr�_ensure_previously_setsz&_ConfigExpander._ensure_previously_set)�	specifierr_c	Cs�ddlm}t|j��f|j}d|krJ|j�||d��t�|d|�Sd|krdt�	|d||�St
d|�d|����WdQRXdS)Nr)�always_iterabler�attrz	invalid `z`: )Z setuptools.extern.more_itertoolsr�rCr6rFrOrcrZZ
read_filesZ	read_attrr0)rPr��	directiver_r�rFrrr�_expand_directivesz!_ConfigExpander._expand_directive)r3rVr_cCs4||jkr$|�d|��|j||�S|�||�dS)Nztool.setuptools.dynamic.)rLr�r�)rPr3rVr_rrrrrs
z_ConfigExpander._obtaincCs,d|jkr(d|jkr(t�|�|d|��SdS)Nrm)rHrLrZrmrr)rPr3r_rrrry(sz_ConfigExpander._obtain_version)r3rcCsLd|jkrdS|j}d|kr<|�|di�|d�dd�d�S|�|d�dS)Nrnzcontent-typez
text/x-rst)�textzcontent-type)rHrLrrr'r�)rPr3rLrrrrz.s
z_ConfigExpander._obtain_readme)r3r_rcszd}t�fdd�|D��sdS��|d|�}|dkr8dSt�|��d�i�ttd����fdd�}|dd	�|d
d��S)N)zentry-pointsrozgui-scriptsc3s|]}|�jkVqdS)N)rH)rsrV)rPrr�	<genexpr>@sz7_ConfigExpander._obtain_entry_points.<locals>.<genexpr>zentry-points)rV�groupcs6|�kr2��|�}|�jkr*tj||d�|�|<dS)N)rV�value)�poprHrr@)rVr�r�)�expanded�groupsrPrr�_set_scriptsJs


z:_ConfigExpander._obtain_entry_points.<locals>._set_scriptsro�console_scriptszgui-scripts�gui_scripts)�anyrrrZ�entry_points�str)rPr3r_�fieldsr�r�r)r�r�rPrrx<s
	

z$_ConfigExpander._obtain_entry_points)r3cCs(d|jkr$|�|di�}|r$|��SdS)Nrp)rHrr�
splitlines)rPr3r�rrrr{Xs

z#_ConfigExpander._obtain_classifierscCs(d|jkr$|�|di�}|r$t|�SdS)Nrq)rHrr�_parse_requirements_list)rPr3r�rrrr|_s

z$_ConfigExpander._obtain_dependenciescsVd�jkrdSd�jkrF�jd}t|t�s0t��fdd�|��D�S��|d�dS)Nzoptional-dependenciescs*i|]"\}}t��d|��|i��|�qS)z.tool.setuptools.dynamic.optional-dependencies.)r�r�)rsr�r�)rPrrrulszA_ConfigExpander._obtain_optional_dependencies.<locals>.<dictcomp>)rHrLrgrj�AssertionErrorr~r�)rPr3Zoptional_dependencies_mapr)rPrr}fs



z-_ConfigExpander._obtain_optional_dependencies)NFN)rY)�__name__�
__module__�__qualname__rjr�_Path�boolrQrTr�rrXr\rr]r`rrarbr�r�rrryrrzrxr{r|r}rrrrrG�s*

rGcCsdd�|��D�S)NcSs&g|]}|��r|���d�s|�qS)�#)r,�
startswith)rs�linerrr�
<listcomp>zsz,_parse_requirements_list.<locals>.<listcomp>)r�)r�rrrr�xsr�)r6c
csZ|sdVdSy
dVWn<tk
rT}zt�d|jj�d|���Wdd}~XYnXdS)Nzignored error: z - )�	Exceptionr-r.�	__class__r�)r6r1rrrrC�s
rCcs>eZdZdeed��fdd�Z�fdd�Z�fdd�Z�ZS)	r^r)�distributionrJrKcst��|�||_||_dS)N)�superrQ�_project_cfg�_setuptools_cfg)rPr�rJrK)r�rrrQ�sz"_EnsurePackagesDiscovered.__init__cs�|j|j}}|�di�}|�|jp&i�||_|j��|jjdkrV|j	�
d�|j_|jdkrl|�
d�|_|jdkr�|�
d�|_t
���S)z�When entering the context, the values of ``packages``, ``py_modules`` and
        ``package_dir`` that are missing in ``dist`` are copied from ``setuptools_cfg``.
        zpackage-dirNr+z
py-modulesre)rMr�rBrcr_�set_defaultsZ_ignore_ext_modules�metadatar+r�r'�
py_modulesrer��	__enter__)rPr3�cfgr_)r�rrr��s


z#_EnsurePackagesDiscovered.__enter__cs4|j�d|jj�|j�d|jj�t��|||�S)z�When exiting the context, if values of ``packages``, ``py_modules`` and
        ``package_dir`` are missing in ``setuptools_cfg``, copy from ``dist``.
        rez
py-modules)r�rBrMrer�r��__exit__)rP�exc_type�	exc_value�	traceback)r�rrr��sz"_EnsurePackagesDiscovered.__exit__)r�r�r�rjrQr�r��
__classcell__rr)r�rr^�sr^c@seZdZdZdS)r?zDSupport for `[tool.setuptools]` in `pyproject.toml` is still *beta*.N)r�r�r�Z_SUMMARYrrrrr?�sr?)F)TFN)NFN)1�__doc__�loggingr;�
contextlibr�	functoolsr�typingrrrrrr	r
�errorsrr
�warningsrr&rrZZ_apply_pyprojecttomlrrrr5rRrr��PathLiker��	getLoggerr�r-rjrr�r)r7r4rErGr�rCZEnsurePackagesDiscoveredr^r?rrrr�<module>
s@$

AY(