�
���c�c � � � d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlmZ ddl m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZ ddlmZmZ ddlmZmZ dd lmZmZ dd
lm Z ddl!m"Z" dd
l#m$Z$ e
rddl%m&Z& ddl'm(Z( ee)ej* f Z+e
dedef f Z, e
de,f Z- eded �� � Z. d4de+de/fd�Z0ddde+ddfd�Z1 d5ddde+dee+ de2ded f
d�Z3d e.d!e)fd"�Z4d#ed de/fd$�Z5 d6d%dd&e-ded' fd(�Z6d)e)d*e)d+e7fd,�Z8 G d-� d.ee. � � Z9 G d/� d0e9d1 � � Z: G d2� d3e9d � � Z;dS )7ze
Load setuptools configuration from ``setup.cfg`` files.
**API will be made private in the future**
� N)�defaultdict)�partial��wraps)�
TYPE_CHECKING�Callable�Any�Dict�Generic�Iterable�List�Optional�Set�Tuple�TypeVar�Union)�DistutilsOptionError�DistutilsFileError)�Requirement�InvalidRequirement)�Version�InvalidVersion)�SpecifierSet)�SetuptoolsDeprecationWarning� )�expand��Distribution)�DistributionMetadata�str�Target)r r )�boundF�filepath�returnc � � ddl m} |� � }|r|� � � ng }t || ||� � }t |� � S )a, Read given configuration file and returns options from it as a dict.
:param str|unicode filepath: Path to configuration file
to get options from.
:param bool find_others: Whether to search for other configuration files
which could be on in various places.
: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.
:rtype: dict
r r )�setuptools.distr �find_config_files�_apply�configuration_to_dict)r# �find_others�ignore_option_errorsr �dist� filenames�handlerss �</usr/lib/python3/dist-packages/setuptools/config/setupcfg.py�read_configurationr0 ( s^ � �( -�,�,�,�,�,��<�>�>�D�,7�?��&�&�(�(�(�R�I��d�H�i�1E�F�F�H� ��*�*�*� r, r c �N � t | |� � | � � � | S )z`Apply the configuration from a ``setup.cfg`` file into an existing
distribution object.
)r( �_finalize_requires)r, r# s r/ �apply_configurationr4 D s+ � � �4������������Kr1 � �other_filesr+ )�
ConfigHandler.c �( � ddl m} t j � |� � }t j � |� � st
d|z � � �t j � � }t j t j � |� � � � g |�|�} |�
| |�� � t | | j |�� � }| �
� � t j |� � n# t j |� � w xY w|S )zHRead configuration from ``filepath`` and applies to the ``dist`` object.r )�
_Distributionz%Configuration file %s does not exist.)r- )r+ )r& |