Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
B

«ËãzÝ"
ã@sòddlmZmZddlZddlZddlZddlZddlZddlm	Z	ddlm
Z
ddlmZddlm
Z
ddlmZmZddlmZmZdd	lmZmZeZddd„Zd
d„Zdd„Zddd„ZGdd„dƒZGdd„deƒZGdd„deƒZdS)é)Úabsolute_importÚunicode_literalsN)Údefaultdict)Úpartial)Úwraps)Ú
import_module)ÚDistutilsOptionErrorÚDistutilsFileError)Ú
LegacyVersionÚparse)Ústring_typesÚPY3Fc		Cs®ddlm}m}tj |¡}tj |¡s4td|ƒ‚t ¡}t 	tj 
|¡¡zJ|ƒ}|rb| ¡ng}||krx| |¡|j
||dt||j|d}Wdt 	|¡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.)Ú	filenames)Úignore_option_errorsN)Zsetuptools.distrrÚosÚpathÚabspathÚisfiler	ÚgetcwdÚchdirÚdirnameÚfind_config_filesÚappendÚparse_config_filesÚparse_configurationÚcommand_optionsÚconfiguration_to_dict)	ÚfilepathZfind_othersrrrZcurrent_directoryÚdistrÚhandlers©r"ú9/tmp/pip-install-5x7thzyg/setuptools/setuptools/config.pyÚread_configurations$

r$cCs.djftƒŽ}t t||¡}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})ÚformatÚlocalsÚ	functoolsrÚgetattr)Ú
target_objÚkeyZgetter_nameZby_attributeÚgetterr"r"r#Ú_get_optionDsr,cCsDttƒ}x6|D].}x(|jD]}t|j|ƒ}|||j|<qWqW|S)z»Returns configuration data gathered by given handlers as a dict.

    :param list[ConfigHandler] handlers: Handlers list,
        usually from parse_configuration()

    :rtype: dict
    )rÚdictÚset_optionsr,r)Úsection_prefix)r!Zconfig_dictÚhandlerÚoptionÚvaluer"r"r#rPs
rcCs6t|||ƒ}| ¡t|j|||jƒ}| ¡||fS)aÒPerforms additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :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: list
    )ÚConfigOptionsHandlerrÚConfigMetadataHandlerÚmetadataÚpackage_dir)ÚdistributionrrÚoptionsÚmetar"r"r#rbs
rc@sÌeZdZdZdZiZd%dd„Zedd„ƒZdd	„Z	e
d&dd„ƒZe
d
d„ƒZe
dd„ƒZ
e
dd„ƒZe
dd„ƒZedd„ƒZedd„ƒZe
d'dd„ƒZe
dd„ƒZe
d(dd„ƒZdd „Zd!d"„Zd#d$„ZdS))Ú
ConfigHandlerz1Handles metadata supplied in configuration files.NFcCsbi}|j}x:| ¡D].\}}| |¡s(q| |d¡ d¡}|||<qW||_||_||_g|_dS)NÚÚ.)	r/ÚitemsÚ
startswithÚreplaceÚstriprr)Úsectionsr.)Úselfr)r8rrAr/Úsection_nameÚsection_optionsr"r"r#Ú__init__s
zConfigHandler.__init__cCstd|jjƒ‚dS)z.Metadata item name to parser function mapping.z!%s must provide .parsers propertyN)ÚNotImplementedErrorÚ	__class__Ú__name__)rBr"r"r#ÚparsersszConfigHandler.parsersc	CsÆtƒ}|j}|j ||¡}t|||ƒ}||kr6t|ƒ‚|r>dSd}|j |¡}|r€y||ƒ}Wn tk
r~d}|jsz‚YnX|rˆdSt|d|dƒ}|dkr®t	|||ƒn||ƒ|j
 |¡dS)NFTzset_%s)Útupler)ÚaliasesÚgetr(ÚKeyErrorrIÚ	ExceptionrÚsetattrr.r)	rBZoption_namer2Úunknownr)Z
current_valueZskip_optionÚparserÚsetterr"r"r#Ú__setitem__£s0zConfigHandler.__setitem__ú,cCs8t|tƒr|Sd|kr | ¡}n
| |¡}dd„|DƒS)z×Represents value as a list.

        Value is split either by separator (defaults to comma) or by lines.

        :param value:
        :param separator: List items separator character.
        :rtype: list
        Ú
cSsg|]}| ¡r| ¡‘qSr")r@)Ú.0Úchunkr"r"r#ú
<listcomp>Ûsz-ConfigHandler._parse_list.<locals>.<listcomp>)Ú
isinstanceÚlistÚ
splitlinesÚsplit)Úclsr2Ú	separatorr"r"r#Ú_parse_listÉs



zConfigHandler._parse_listcCsTd}i}xF| |¡D]8}| |¡\}}}||kr<td|ƒ‚| ¡|| ¡<qW|S)zPRepresents value as a dict.

        :param value:
        :rtype: dict
        ú=z(Unable to parse option value to dict: %s)r_Ú	partitionrr@)r]r2r^ÚresultÚliner*ÚsepÚvalr"r"r#Ú_parse_dictÝs
zConfigHandler._parse_dictcCs| ¡}|dkS)zQRepresents value as boolean.

        :param value:
        :rtype: bool
        )Ú1ÚtrueÚyes)Úlower)r]r2r"r"r#Ú_parse_boolïszConfigHandler._parse_boolcs‡fdd„}|S)zßReturns a parser function to make sure field inputs
        are not files.

        Parses a value after getting the key so error messages are
        more informative.

        :param key:
        :rtype: callable
        cs d}| |¡rtd ˆ¡ƒ‚|S)Nzfile:zCOnly strings are accepted for the {0} field, files are not accepted)r>Ú
ValueErrorr%)r2Zexclude_directive)r*r"r#rQs
z3ConfigHandler._exclude_files_parser.<locals>.parserr")r]r*rQr")r*r#Ú_exclude_files_parserùsz#ConfigHandler._exclude_files_parsercs\d}t|tƒs|S| |¡s |S|t|ƒd…}dd„| d¡Dƒ}d ‡fdd„|Dƒ¡S)aORepresents 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
        zfile:Ncss|]}tj | ¡¡VqdS)N)rrrr@)rVrr"r"r#ú	<genexpr>$sz,ConfigHandler._parse_file.<locals>.<genexpr>rTrUc3s.|]&}ˆ |¡stj |¡rˆ |¡VqdS)TN)Ú
_assert_localrrrÚ
_read_file)rVr)r]r"r#rn&s
)rYrr>Úlenr\Újoin)r]r2Zinclude_directiveÚspecZ	filepathsr")r]r#Ú_parse_file
s


zConfigHandler._parse_filecCs| t ¡¡std|ƒ‚dS)Nz#`file:` directive can not access %s)r>rrr)rr"r"r#ro,szConfigHandler._assert_localc	Cs"tj|dd
}| ¡SQRXdS)Nzutf-8)Úencoding)ÚioÚopenÚread)rÚfr"r"r#rp2szConfigHandler._read_filec	Csþd}| |¡s|S| |d¡ ¡ d¡}| ¡}d |¡}|p@d}t ¡}|rÂ|d|kr¤||d}| dd¡}	t	|	ƒdkržtj
 t ¡|	d¡}|	d}qÂ|}nd|krÂtj
 t ¡|d¡}tj
 d|¡zt
|ƒ}
t|
|ƒ}Wdtj
dd…t_
X|S)	z·Represents value as a module attribute.

        Examples:
            attr: package.attr
            attr: package.module.attr

        :param str value:
        :rtype: str
        zattr:r;r<rErú/éN)r>r?r@r\ÚpoprrrrÚrsplitrqrÚsysÚinsertrr()r]r2r6Zattr_directiveZ
attrs_pathÚ	attr_nameÚmodule_nameÚparent_pathZcustom_pathÚpartsÚmoduler"r"r#Ú_parse_attr7s0


zConfigHandler._parse_attrcs‡fdd„}|S)z¹Returns parser function to represents value as a list.

        Parses a value applying given methods one after another.

        :param parse_methods:
        :rtype: callable
        cs|}xˆD]}||ƒ}q
W|S)Nr")r2ÚparsedÚmethod)Ú
parse_methodsr"r#rms
z1ConfigHandler._get_parser_compound.<locals>.parser")r]rˆrr")rˆr#Ú_get_parser_compoundds	z"ConfigHandler._get_parser_compoundcCs:i}|pdd„}x$| ¡D]\}\}}||ƒ||<qW|S)zÊParses section options into a dictionary.

        Optionally applies a given parser to values.

        :param dict section_options:
        :param callable values_parser:
        :rtype: dict
        cSs|S)Nr")rer"r"r#Ú<lambda>‚óz6ConfigHandler._parse_section_to_dict.<locals>.<lambda>)r=)r]rDZ
values_parserr2r*Ú_rer"r"r#Ú_parse_section_to_dictws

z$ConfigHandler._parse_section_to_dictc	Cs@x:| ¡D].\}\}}y|||<Wq
tk
r6Yq
Xq
WdS)zQParses configuration file section.

        :param dict section_options:
        N)r=rM)rBrDÚnamerŒr2r"r"r#Ú
parse_section‡s
zConfigHandler.parse_sectioncCsfx`|j ¡D]R\}}d}|r$d|}t|d| dd¡dƒ}|dkrVtd|j|fƒ‚||ƒqWdS)zTParses configuration file items from one
        or more related sections.

        r;z_%szparse_section%sr<Ú__Nz0Unsupported distribution option section: [%s.%s])rAr=r(r?rr/)rBrCrDZmethod_postfixZsection_parser_methodr"r"r#r“szConfigHandler.parsecstˆƒ‡‡‡fdd„ƒ}|S)zé this function will wrap around parameters that are deprecated

        :param msg: deprecation message
        :param warning_class: class of warning exception to be raised
        :param func: function to be wrapped around
        cst ˆˆ¡ˆ||ŽS)N)ÚwarningsÚwarn)ÚargsÚkwargs)ÚfuncÚmsgÚ
warning_classr"r#Úconfig_handler²sz@ConfigHandler._deprecated_config_handler.<locals>.config_handler)r)rBr•r–r—r˜r")r•r–r—r#Ú_deprecated_config_handler«sz(ConfigHandler._deprecated_config_handler)F)rT)N)N)rHÚ
__module__Ú__qualname__Ú__doc__r/rKrEÚpropertyrIrSÚclassmethodr_rfrkrmrtÚstaticmethodrorpr…r‰rrrr™r"r"r"r#r:}s,
&
,r:csHeZdZdZdddddœZdZd‡fd	d
„	Zedd„ƒZd
d„Z	‡Z
S)r4r5ÚurlÚdescriptionÚclassifiersÚ	platforms)Z	home_pageÚsummaryÚ
classifierÚplatformFNcstt|ƒ |||¡||_dS)N)Úsuperr4rEr6)rBr)r8rr6)rGr"r#rEËszConfigMetadataHandler.__init__cCsL|j}|j}|j}|j}|||| |dt¡|| ||¡|dƒ|||j|dœS)z.Metadata item name to parser function mapping.z[The requires parameter is deprecated, please use install_requires for runtime dependencies.Úlicense)r£ÚkeywordsÚprovidesÚrequiresÚ	obsoletesr¢r¨r¡Úlong_descriptionÚversionZproject_urls)r_rtrfrmr™ÚDeprecationWarningr‰Ú_parse_version)rBÚ
parse_listZ
parse_fileÚ
parse_dictZexclude_files_parserr"r"r#rIÑs$
zConfigMetadataHandler.parserscCs| |¡}||krB| ¡}tt|ƒtƒr>d}t|jftƒŽƒ‚|S| ||j	¡}t
|ƒr^|ƒ}t|tƒsŒt|dƒr„d 
tt|ƒ¡}nd|}|S)zSParses `version` option value.

        :param value:
        :rtype: str

        zCVersion loaded from {value} does not comply with PEP 440: {version}Ú__iter__r<z%s)rtr@rYrr
rr%r&r…r6ÚcallablerÚhasattrrrÚmapÚstr)rBr2r®Útmplr"r"r#r°ës


z$ConfigMetadataHandler._parse_version)FN)rHršr›r/rKZstrict_moderErrIr°Ú
__classcell__r"r")rGr#r4ºsr4c@s\eZdZdZedd„ƒZdd„Zdd„Zdd	„Zd
d„Z	dd
„Z
dd„Zdd„Zdd„Z
dS)r3r8cCsL|j}t|jdd}|j}|j}|||||||||||||||j|j|dœS)z.Metadata item name to parser function mapping.ú;)r^)Zzip_safeZuse_2to3Zinclude_package_datar6Zuse_2to3_fixersZuse_2to3_exclude_fixersZconvert_2to3_doctestsÚscriptsZeager_resourcesÚdependency_linksZnamespace_packagesZinstall_requiresZsetup_requiresZ
tests_requireÚpackagesÚentry_pointsÚ
py_modules)r_rrkrfÚ_parse_packagesrt)rBr±Zparse_list_semicolonZ
parse_boolr²r"r"r#rIs*zConfigOptionsHandler.parserscCszddg}| ¡}||kr"| |¡S||dk}|r>ts>tdƒ‚| |j di¡¡}|rdddlm}nddlm	}|f|ŽS)	zTParses `packages` option value.

        :param value:
        :rtype: list
        zfind:zfind_namespace:r{z8find_namespace: directive is unsupported on Python < 3.3z
packages.findr)Úfind_namespace_packages)Ú
find_packages)
r@r_r
rÚparse_section_packages__findrArLÚ
setuptoolsrÁrÂ)rBr2Zfind_directivesZ
trimmed_valueZfindnsÚfind_kwargsrÂr"r"r#rÀ/s
z$ConfigOptionsHandler._parse_packagescsT| ||j¡}dddg‰t‡fdd„| ¡Dƒƒ}| d¡}|dk	rP|d|d<|S)zœParses `packages.find` configuration file section.

        To be used in conjunction with _parse_packages().

        :param dict section_options:
        ÚwhereÚincludeÚexcludecs$g|]\}}|ˆkr|r||f‘qSr"r")rVÚkÚv)Ú
valid_keysr"r#rXXszEConfigOptionsHandler.parse_section_packages__find.<locals>.<listcomp>Nr)rr_r-r=rL)rBrDZsection_datarÅrÆr")rËr#rÃKs


z1ConfigOptionsHandler.parse_section_packages__findcCs| ||j¡}||d<dS)z`Parses `entry_points` configuration file section.

        :param dict section_options:
        r¾N)rr_)rBrDr†r"r"r#Úparse_section_entry_points`sz/ConfigOptionsHandler.parse_section_entry_pointscCs.| ||j¡}| d¡}|r*||d<|d=|S)NÚ*r;)rr_rL)rBrDr†Úrootr"r"r#Ú_parse_package_datahs
z(ConfigOptionsHandler._parse_package_datacCs| |¡|d<dS)z`Parses `package_data` configuration file section.

        :param dict section_options:
        Úpackage_dataN)rÏ)rBrDr"r"r#Úparse_section_package_datarsz/ConfigOptionsHandler.parse_section_package_datacCs| |¡|d<dS)zhParses `exclude_package_data` configuration file section.

        :param dict section_options:
        Zexclude_package_dataN)rÏ)rBrDr"r"r#Ú"parse_section_exclude_package_dataysz7ConfigOptionsHandler.parse_section_exclude_package_datacCs"t|jdd}| ||¡|d<dS)zbParses `extras_require` configuration file section.

        :param dict section_options:
        rº)r^Zextras_requireN)rr_r)rBrDr±r"r"r#Úparse_section_extras_requiresz1ConfigOptionsHandler.parse_section_extras_requirecCs(| ||j¡}dd„| ¡Dƒ|d<dS)z^Parses `data_files` configuration file section.

        :param dict section_options:
        cSsg|]\}}||f‘qSr"r")rVrÉrÊr"r"r#rXszAConfigOptionsHandler.parse_section_data_files.<locals>.<listcomp>Ú
data_filesN)rr_r=)rBrDr†r"r"r#Úparse_section_data_filesŠsz-ConfigOptionsHandler.parse_section_data_filesN)rHršr›r/rrIrÀrÃrÌrÏrÑrÒrÓrÕr"r"r"r#r3s
	r3)FF)F) Ú
__future__rrrvrr~r‘r'ÚcollectionsrrrÚ	importlibrZdistutils.errorsrr	Z#setuptools.extern.packaging.versionr
rZsetuptools.extern.sixrr
ÚtypeÚ
__metaclass__r$r,rrr:r4r3r"r"r"r#Ú<module>s,
.
?U