3 ÄvhVF ã @ sÈ d dl mZmZ d dlZd dlZd dlZd dlmZ d dlm Z d dl mZ d dlm Z mZ d dlmZmZ d dlmZ dd d„Zdd „ Zddd„ZG dd„ deƒZG dd„ deƒZG dd„ deƒZdS )é )Úabsolute_importÚunicode_literalsN)Údefaultdict)Úpartial)Ú import_module)ÚDistutilsOptionErrorÚDistutilsFileError)Ú LegacyVersionÚparse)Ústring_typesFc C s® ddl m}m} tjj| ƒ} tjj| ƒs4td| ƒ‚tjƒ }tj tjj | ƒƒ zJ|ƒ }|rb|jƒ ng }| |krx|j| ƒ |j ||d� t||j|d�}W dtj |ƒ 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.distr r ÚosÚpathÚabspathÚisfiler ÚgetcwdÚchdirÚdirnameZfind_config_filesÚappendZparse_config_filesÚparse_configurationÚcommand_optionsÚconfiguration_to_dict) ÚfilepathZfind_othersr r r Zcurrent_directoryZdistr Úhandlers© r ú/usr/lib/python3.6/config.pyÚread_configuration s$ r c C sl t tƒ}x^| D ]V}|j}|j}xD|jD ]:}t|d| dƒ}|dkrNt||ƒ}n|ƒ }||| |<