ó þ¾v]c@@sJddlmZmZddlZddlZddlZddlZddlZddlm Z ddlm Z ddlm Z ddl m Z ddlmZmZddlmZmZdd lmZmZeZeed „Zd „Zd „Zed „Zdfd„ƒYZdefd„ƒYZdefd„ƒYZ dS(i(tabsolute_importtunicode_literalsN(t defaultdict(tpartial(twraps(t import_module(tDistutilsOptionErrortDistutilsFileError(t LegacyVersiontparse(t string_typestPY3c C@sùddlm}m}tjj|ƒ}tjj|ƒsMtd|ƒ‚ntjƒ}tj tjj |ƒƒzl|ƒ}|r|j ƒng}||kr²|j |ƒn|j |d|ƒt||jd|ƒ}Wdtj |ƒXt|ƒS(u,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 i(t Distributiont _Distributionu%Configuration file %s does not exist.t filenamestignore_option_errorsN(tsetuptools.distR R tostpathtabspathtisfileRtgetcwdtchdirtdirnametfind_config_filestappendtparse_config_filestparse_configurationtcommand_optionstconfiguration_to_dict( tfilepatht find_othersRR R tcurrent_directorytdistRthandlers((s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pytread_configurations$     cC@s@djtƒ}tjt||ƒ}t|||ƒ}|ƒS(u  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. u get_{key}(tformattlocalst functoolsRtgetattr(t target_objtkeyt getter_namet by_attributetgetter((s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pyt _get_optionDscC@sXttƒ}xE|D]=}x4|jD])}t|j|ƒ}|||j|t ValueErrorR$(R4texclude_directive(R)(s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pyRWs ((R^R)RW((R)s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pyt_exclude_files_parserùs c@srd}t|tƒs|S|j|ƒs,|S|t|ƒ}d„|jdƒDƒ}dj‡fd†|DƒƒS(uORepresents value as a string, allowing including text from nearest files using `file:` directive. Directive is sandboxed and won't reach anything outside directory with setup.py. Examples: file: README.rst, CHANGELOG.md, src/file.txt :param str value: :rtype: str ufile:cs@s'|]}tjj|jƒƒVqdS(N(RRRR@(t.0R((s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pys $su,u c3@sE|];}ˆj|ƒstrtjj|ƒrˆj|ƒVqdS(N(t _assert_localRPRRRt _read_file(RmR(R^(s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pys &s(RZR R>tlenR]tjoin(R^R4tinclude_directivetspect filepaths((R^s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pyt _parse_file s cC@s,|jtjƒƒs(td|ƒ‚ndS(Nu#`file:` directive can not access %s(R>RRR(R((s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pyRn,scC@s,tj|ddƒ}|jƒSWdQXdS(Ntencodinguutf-8(tiotopentread(Rtf((s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pyRo2sc C@sed}|j|ƒs|S|j|dƒjƒjdƒ}|jƒ}dj|ƒ}|p^d}tjƒ}|r|d|krê||d}|jddƒ} t | ƒdkrátj jtjƒ| dƒ}| d}q|}qd|krtj jtjƒ|dƒ}qnt j j d|ƒzt |ƒ} t| |ƒ}Wdt j dt _ X|S( u·Represents value as a module attribute. Examples: attr: package.attr attr: package.module.attr :param str value: :rtype: str uattr:uu.u__init__iu/iN(R>R?R@R]tpopRqRRtrsplitRpRtsystinsertRR'( R^R4R8tattr_directivet attrs_patht attr_namet module_namet parent_patht custom_pathtpartstmodule((s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pyt _parse_attr7s0 !      % c@s‡fd†}|S(u¹Returns parser function to represents value as a list. Parses a value applying given methods one after another. :param parse_methods: :rtype: callable c@s'|}xˆD]}||ƒ}q W|S(N((R4tparsedtmethod(t parse_methods(s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pyR ms ((R^RŠR ((RŠs7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pyt_get_parser_compoundds cC@sLi}|pd„}x0|jƒD]"\}\}}||ƒ||‚t(R=(R^RDt values_parserR4R)t_Rf((s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pyt_parse_section_to_dictws cC@sIxB|jƒD]4\}\}}y|||||d<|d=n|S(Nu*u(RRaRL(RBRDRˆtroot((s7/tmp/pip-install-vZZv26/setuptools/setuptools/config.pyt_parse_package_datahs   cC@s|j|ƒ|ds*     .  ÿ>U