Re?@sddlmZmZddlZddlZddlZddlmZddlm Z ddl m Z m Z ddl mZddlmZddd d Zd d Zdd dZGdddeZGdddeZGdddeZdS))absolute_importunicode_literalsN) defaultdict)partial)DistutilsOptionErrorDistutilsFileError) import_module) string_typesFc Csddlm}m}tjj|}tjj|sJtd|tj}tj tjj |zi|}|r|j ng}||kr|j ||j |d|t||jd|}Wdtj |Xt|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. filenamesignore_option_errorsN)Zsetuptools.distr r ospathabspathisfilergetcwdchdirdirnamefind_config_filesappendparse_config_filesparse_configurationcommand_optionsconfiguration_to_dict) filepathZ find_othersr r r Zcurrent_directorydistr handlersr/builddir/build/BUILDROOT/alt-python35-setuptools-36.3.0-4.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/setuptools/config.pyread_configuration s$       r cCstt}x|D]w}|j}|j}x\|jD]Q}t|d|d}|dkrot||}n |}||||s z-ConfigHandler._parse_list..) isinstancelist splitlinessplit)clsr) separatorrrr _parse_lists  zConfigHandler._parse_listcCstd}i}xa|j|D]P}|j|\}}}||krVtd||j||jsz,ConfigHandler._parse_file..rKrLc3sE|];}j|sdrtjj|rj|VqdS)TN) _assert_localrrr _read_file)rMr)rTrrrd s)rPr r5lenrSjoin)rTr)Zinclude_directivespecZ filepathsr)rTr _parse_fileszConfigHandler._parse_filecCs)|jtjs%td|dS)Nz#`file:` directive can not access %s)r5rrr)rrrrreszConfigHandler._assert_localc Cs-tj|dd}|jSWdQRXdS)Nencodingzutf-8)ioopenread)rfrrrrfszConfigHandler._read_filec Csd}|j|s|S|j|djjd}|j}dj|}|p^d}tjjdt j zt |}t ||}Wdtjddt_X|S)zRepresents value as a module attribute. Examples: attr: package.attr attr: package.module.attr :param str value: :rtype: str zattr:r2r3r<rN) r5r6r7rSpoprhsysrinsertrrrr%)rTr)Zattr_directiveZ attrs_path attr_name module_namemodulerrr _parse_attrs !   zConfigHandler._parse_attrcsfdd}|S)zReturns parser function to represents value as a list. Parses a value applying given methods one after another. :param parse_methods: :rtype: callable cs'|}xD]}||}q W|S)Nr)r)parsedmethod) parse_methodsrrr,Bs z1ConfigHandler._get_parser_compound..parser)rTrzr,r)rzr_get_parser_compound9s z"ConfigHandler._get_parser_compoundcCsOi}|pdd}x0|jD]"\}\}}||||Wsz6ConfigHandler._parse_section_to_dict..)r4)rTr;Z values_parserr)r[_r]rrr_parse_section_to_dictLs z$ConfigHandler._parse_section_to_dictc CsJxC|jD]5\}\}}y|||.Nr)r~rVr!r4rC)r9r;Z section_datarrr)rrrs" z1ConfigOptionsHandler.parse_section_packages__findcCs#|j||j}||ds   . 9