U Qab6P @ s d dl mZmZ d dlZd dlZd dlZd dlZd dlZd dlm Z d dlm Z d dlmZ d dlm Z d dlmZmZ d dlmZmZ d d lmZ d d lmZmZ eZddd Zdd Zdd ZdddZG dd dZG dd deZ G dd deZ!dS ) )absolute_importunicode_literalsN)defaultdict)partialwraps) import_module)DistutilsOptionErrorDistutilsFileError) LegacyVersionparse)SpecifierSet)string_typesPY3Fc C s ddl m}m} tj| } tj| s4td| t }t tj | zJ| }|rb| ng }| |krx|| |j ||d t||j|d}W 5 t | 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_errors)Zsetuptools.distr r ospathabspathisfiler getcwdchdirdirnameZfind_config_filesappendZparse_config_filesparse_configurationcommand_optionsconfiguration_to_dict) filepathZfind_othersr r r Zcurrent_directoryZdistr handlers r! 5/usr/lib/python3.8/site-packages/setuptools/config.pyread_configuration s* r# c C s. dj f t }tt| |}t| ||}| S )z Given a target object and option key, get that option from the target object, either through a get_{key} method or from an attribute directly. z get_{key})formatlocals functoolsr getattr) target_objkeyZgetter_nameZby_attributegetterr! r! r" _get_optionE s r+ c C s<