File: //opt/alt/python37/lib/python3.7/site-packages/setuptools/__pycache__/config.cpython-37.pyc
B
m�ReSZ � @ s d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dlm Z d dlm
Z
d dlmZ d dl
Z
d dlmZmZ d dlmZmZ d dlmZ G d d
� d
�Ze
jdd� �Zddd�Zdd� Zdd� Zddd�ZG dd� d�ZG dd� de�ZG dd� de�ZdS )� N)�defaultdict)�partial)�wraps)�iglob)�DistutilsOptionError�DistutilsFileError)�
LegacyVersion�parse)�SpecifierSetc @ s e Zd ZdZdd� Zdd� ZdS )�StaticModulez0
Attempt to load the module by the name
c C sL t j�|�}t|j��}|�� }W d Q R X t�|�}t| �� t
� � | `d S )N)� importlib�util� find_spec�open�origin�read�astr �vars�update�locals�self)r �name�specZstrm�src�module� r �B/opt/alt/python37/lib/python3.7/site-packages/setuptools/config.py�__init__ s
zStaticModule.__init__c
sV yt � fdd�| jjD ��S tk
rP } ztdjf t� ��|�W d d }~X Y nX d S )Nc 3 sH | ]@}t |tj�r|jD ](}t |tj�r|j� krt�|j�V qqd S )N)�
isinstancer ZAssignZtargets�Name�idZliteral_eval�value)�.0Z statement�target)�attrr r � <genexpr>$ s
z+StaticModule.__getattr__.<locals>.<genexpr>z#{self.name} has no attribute {attr})�nextr Zbody� Exception�AttributeError�formatr )r r$ �er )r$ r �__getattr__! s
zStaticModule.__getattr__N)�__name__�
__module__�__qualname__�__doc__r r+ r r r r r s r c c s, zt j�d| � dV W dt j�| � X dS )zH
Add path to front of sys.path for the duration of the context.
r N)�sys�path�insert�remove)r1 r r r �
patch_path0 s
r4 Fc C s� ddl m}m} tj�| �} tj�| �s4td| ��t�� }t� tj�
| �� zJ|� }|rb|�� ng }| |krx|�| � |j
||d� t||j|d�}W dt� |� X 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 )�Distribution�
_Distributionz%Configuration file %s does not exist.)� filenames)�ignore_option_errorsN)Zsetuptools.distr5 r6 �osr1 �abspath�isfiler �getcwd�chdir�dirnameZfind_config_files�appendZparse_config_files�parse_configuration�command_options�configuration_to_dict) �filepathZfind_othersr8 r5 r6 Zcurrent_directoryZdistr7 �handlersr r r �read_configuration<