ruạṛ
a �u:j�G � @ s� d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl m Z ddlmZ ddl mZmZmZ d d lmZ d dlmZmZ d dlmZ d dlmZ d dlmZmZmZ er�ddl m!Z! ddl"m#Z# e�$e%�Z&ddd�dd�Z'dddd�dd�Z(d7ddddd�dd�Z)d8dddd!d"d#�d$d%�Z*d9dd&dd!dd'�d(d)�Z+G d*d+� d+�Z,d,d-� Z-edd.�d/d0��Z.G d1d2� d2ej/�Z0G d3d4� d4e�Z1G d5d6� d6e�Z2dS ):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``. � )�annotationsN)�Mapping)�contextmanager)�partial)� TracebackType)� TYPE_CHECKING�Any�Callable� )�StrPath)� FileError�InvalidConfigError)�SetuptoolsWarning� )�expand)�_PREVIOUSLY_DEFINED�_MissingDynamic�apply)�Self��Distributionr �dict)�filepath�returnc C sD ddl m} t| d��}|�|�W d � S 1 s60 Y d S )Nr )�tomllib�rb)Zcompat.py310r �open�load)r r �file� r �R/opt/bart/bart_venv/lib/python3.9/site-packages/setuptools/config/pyprojecttoml.py� load_file$ s r! �bool)�configr r c C s� ddl m} |j�d�}t|d�r*|�� z|�| �W S |jy� } z`d|j� �}|j � d�dkrzt�|� t�|j � d|j � d �}t|� d |� ��d �W Y d }~n d }~0 0 d S )Nr )�_validate_pyprojectztrove-classifier�_disable_downloadzconfiguration error: �`�projectzinvalid pyproject.toml config: �.� )� r$ ZFORMAT_FUNCTIONS�get�hasattrr% �validateZValidationError�summary�name�strip�_logger�debug�details� ValueError)r# r � validatorZtrove_classifier�exr. �errorr r r r- + s r- Fr )�distr �ignore_option_errorsr c C s t |d|| �}t| ||�S )zeApply the configuration from a ``pyproject.toml`` file into an existing distribution object. T)�read_configuration�_apply)r8 r r9 r# r r r �apply_configuration@ s r<