U Va@sddlmZddlmZddlZddlZddlZddlZddlmZddl m Z ej Z ddZ dd Zejdd kreZefZn eZeefZd d Z dS) )core)errorsN)dist)utilcCsttjt_dSN)rZ_get_unpatchedr Distributionrr/core.py_monkeypatch_distribution=sr cCs tt_dSr)_saved_core_distributionrrrrrr !_restore_distribution_monkeypatchAsr c szt|sWrdSt|tr0tj|}n tjd}tj|sVt d|zt |}WnBt k rt d}tdtd||jj|fYnX|r4|D]|\}}t|jd|rt|jd||qt|j|rt|j||qt||rt|||qdt|}t|qtj|t|jjt t!frft"|jj|j_d d gt #fd d |_$W5tXdS) a9Implements the actual pbr setup() keyword. When used, this should be the only keyword in your setup() aside from `setup_requires`. If given as a string, the value of pbr is assumed to be the relative path to the setup.cfg file to use. Otherwise, if it evaluates to true, it simply assumes that pbr should be used, and the default 'setup.cfg' is used. This works by reading the setup.cfg file, parsing out the supported metadata and command options, and using them to rebuild the `DistributionMetadata` object and set the newly added command options. The reason for doing things this way is that a custom `Distribution` class will not play nicely with setup_requires; however, this implementation may not work well with distributions that do use a `Distribution` subclass. Nz setup.cfgz%The setup.cfg file %s does not exist.z Error parsingzError parsing %s: %s: %sZset_zUnknown distribution option: %sz pre_hook.*z post_hook.*cs tSr)rZ IgnoreDictrignorerr zpbr..)%r r isinstance string_typeospathabspathexistsrZDistutilsFileErrorrZ cfg_to_args Exceptionsysexc_infologgingZ exceptionZDistutilsSetupError __class____name__itemshasattrZmetadatagetattrsetattrreprwarningswarnrrZfinalize_optionsversion integer_typesfloatstrZDefaultGetDictZcommand_options) rattrvaluerZattrsekeyvalmsgrrr pbrMsJ            r0)Z distutilsrrrrrr$Z setuptoolsrr0rrr r r version_infor)rintr'Z basestringZlongrrrr .s