Viewing File: /opt/alt/python38/lib/python3.8/site-packages/setuptools/__pycache__/config.cpython-38.pyc

U

+aW@sddlZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlZddlm
Z
mZddlmZmZddlmZGdd	d	Zejd
dZdd
dZddZddZdddZGdddZGdddeZGdddeZdS)N)defaultdict)partialwraps)DistutilsOptionErrorDistutilsFileError)
LegacyVersionparse)SpecifierSetc@s eZdZdZddZddZdS)StaticModulez0
    Attempt to load the module by the name
    c	CsLtj|}t|j}|}W5QRXt|}t|	t
|`dSN)	importlibutil	find_specopenoriginreadastr	varsupdatelocalsself)rnamespecstrmsrcmoduler9/tmp/pip-install-1bd_1mtk/setuptools/setuptools/config.py__init__s
zStaticModule.__init__c
sXztfdd|jjDWStk
rR}ztdjft|W5d}~XYnXdS)Nc3sH|]@}t|tjr|jD](}t|tjr|jkrt|jVqqdSr)
isinstancerZAssigntargetsNameidliteral_evalvalue).0Z	statementtargetattrrr	<genexpr>!s
z+StaticModule.__getattr__.<locals>.<genexpr>z#{self.name} has no attribute {attr})nextrbody	ExceptionAttributeErrorformatr)rr)err(r__getattr__s
zStaticModule.__getattr__N)__name__
__module____qualname____doc__rr1rrrrrsrc	cs,ztjd|dVW5tj|XdS)zH
    Add path to front of sys.path for the duration of the context.
    rN)syspathremoveinsert)r7rrr
patch_path.s
r:Fc		Csddlm}m}tj|}tj|s4td|t}t	tj
|zJ|}|rb|ng}||krx|||j
||dt||j|d}W5t	|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_errors)Zsetuptools.distr;r<osr7abspathisfilergetcwdchdirdirnamefind_config_filesappendparse_config_filesparse_configurationcommand_optionsconfiguration_to_dict)	filepathZfind_othersr>r;r<Zcurrent_directorydistr=handlersrrrread_configuration:s*

rNcCs.djft}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})r/r	functoolsrgetattr)
target_objkeyZgetter_nameZby_attributegetterrrr_get_optionisrTcCs<tt}|D]*}|jD]}t|j|}|||j|<qq|S)zReturns configuration data gathered by given handlers as a dict.

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

    :rtype: dict
    )rdictset_optionsrTrQsection_prefix)rMZconfig_dicthandleroptionr%rrrrJus
rJcCs6t|||}|t|j|||j}|||fS)aPerforms 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	ConfigMetadataHandlermetadatapackage_dir)distributionrIr>optionsmetarrrrHsrHc@seZdZdZdZiZd%ddZeddZdd	Z	e
d&ddZe
d
dZe
ddZ
e
ddZe
ddZeddZeddZe
d'ddZe
ddZe
d(ddZdd Zd!d"Zd#d$ZdS))
ConfigHandlerz1Handles metadata supplied in configuration files.NFcCs^i}|j}|D].\}}||s&q||dd}|||<q||_||_||_g|_dS)N.)	rWitems
startswithreplacestripr>rQsectionsrV)rrQr_r>rhrWsection_namesection_optionsrrrrs

zConfigHandler.__init__cCstd|jjdS).Metadata item name to parser function mapping.z!%s must provide .parsers propertyN)NotImplementedError	__class__r2)rrrrparserss
zConfigHandler.parsersc	Cst}|j}|j||}t|||}||kr6t||r>dSd}|j|}|rz||}Wn tk
r~d}|jszYnX|rdSt|d|d}|dkrt	|||n|||j
|dS)NFTzset_%s)tuplerQaliasesgetrPKeyErrorrnr-r>setattrrVrF)	rZoption_namer%unknownrQZ
current_valueZskip_optionparsersetterrrr__setitem__s0zConfigHandler.__setitem__,cCs8t|tr|Sd|kr |}n
||}dd|DS)zRepresents 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)rg)r&chunkrrr
<listcomp>sz-ConfigHandler._parse_list.<locals>.<listcomp>)r list
splitlinessplit)clsr%	separatorrrr_parse_lists



zConfigHandler._parse_listcCsPd}i}||D]8}||\}}}||kr:td||||<q|S)zPRepresents value as a dict.

        :param value:
        :rtype: dict
        =z(Unable to parse option value to dict: %s)r	partitionrrg)rr%rresultlinerRsepvalrrr_parse_dictszConfigHandler._parse_dictcCs|}|dkS)zQRepresents value as boolean.

        :param value:
        :rtype: bool
        )1trueyes)lower)rr%rrr_parse_boolszConfigHandler._parse_boolcsfdd}|S)zReturns 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)Nfile:zCOnly strings are accepted for the {0} field, files are not accepted)re
ValueErrorr/)r%Zexclude_directiverRrrru)s
z3ConfigHandler._exclude_files_parser.<locals>.parserr)rrRrurrr_exclude_files_parsersz#ConfigHandler._exclude_files_parsercs\d}t|ts|S||s |S|t|d}dd|dD}dfdd|DS)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
        rNcss|]}tj|VqdSr)r?r7r@rgr&r7rrrr*Isz,ConfigHandler._parse_file.<locals>.<genexpr>rxryc3s.|]&}|stj|r|VqdS)TN)
_assert_localr?r7rA
_read_filerrrrr*Js

)r strrelenr~join)rr%Zinclude_directiverZ	filepathsrrr_parse_file2s

zConfigHandler._parse_filecCs|tstd|dS)Nz#`file:` directive can not access %s)rer?rBr)rKrrrrQszConfigHandler._assert_localc
Cs.tj|dd}|W5QRSQRXdS)Nzutf-8)encoding)iorr)rKfrrrrWszConfigHandler._read_filec
Csd}||s|S||dd}|}d|}|p@d}t}|r|d|kr||d}|dd}	t	|	dkrtj
t|	d}|	d}q|}nd|krtj
t|d}t|Dztt
||WW5QRStk
rt|}
YnXW5QRXt|
|S)zRepresents value as a module attribute.

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

        :param str value:
        :rtype: str
        zattr:rbrcrr/)rerfrgr~poprr?rBrsplitrr7r:rPrr-r

import_module)rr%r]Zattr_directiveZ
attrs_path	attr_namemodule_nameparent_pathZcustom_pathpartsrrrr_parse_attr\s0



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|}D]}||}q|Srr)r%parsedmethod
parse_methodsrrr	s
z1ConfigHandler._get_parser_compound.<locals>.parser)rrr	rrr_get_parser_compounds	z"ConfigHandler._get_parser_compoundcCs6i}|pdd}|D]\}\}}||||<q|S)zParses section options into a dictionary.

        Optionally applies a given parser to values.

        :param dict section_options:
        :param callable values_parser:
        :rtype: dict
        cSs|Srr)rrrr<lambda>z6ConfigHandler._parse_section_to_dict.<locals>.<lambda>)rd)rrjZ
values_parserr%rR_rrrr_parse_section_to_dicts

z$ConfigHandler._parse_section_to_dictc	Cs<|D].\}\}}z|||<Wqtk
r4YqXqdS)zQParses configuration file section.

        :param dict section_options:
        N)rdrr)rrjrrr%rrr
parse_sections
zConfigHandler.parse_sectioncCsb|jD]R\}}d}|r"d|}t|d|ddd}|dkrTtd|j|f||q
dS)zTParses configuration file items from one
        or more related sections.

        rbz_%szparse_section%src__Nz0Unsupported distribution option section: [%s.%s])rhrdrPrfrrW)rrirjZmethod_postfixZsection_parser_methodrrrr	s"zConfigHandler.parsecstfdd}|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||Sr)warningswarn)argskwargsfuncmsg
warning_classrrconfig_handlersz@ConfigHandler._deprecated_config_handler.<locals>.config_handlerr)rrrrrrrr_deprecated_config_handlersz(ConfigHandler._deprecated_config_handler)F)rx)N)N)r2r3r4r5rWrprpropertyrnrwclassmethodrrrrrstaticmethodrrrrrrr	rrrrrras<

&

	



-
racsHeZdZdZdddddZdZdfd	d
	ZeddZd
dZ	Z
S)r[r\urldescriptionclassifiers	platforms)Z	home_pagesummary
classifierplatformFNcstt||||||_dSr)superr[rr])rrQr_r>r]rmrrrszConfigMetadataHandler.__init__cCs^|j}|j}|j}|j}|||||dt|||||d||ddt||||j|d
S)rkz[The requires parameter is deprecated, please use install_requires for runtime dependencies.licenselicense_filezDThe license_file parameter is deprecated, use license_files instead.)
rkeywordsprovidesrequires	obsoletesrrrZ
license_filesrlong_descriptionversionZproject_urls)rrrrrDeprecationWarningr_parse_version)r
parse_listZ
parse_file
parse_dictZexclude_files_parserrrrrns4
zConfigMetadataHandler.parserscCs||}||krB|}tt|tr>d}t|jft|S|||j	}t
|r^|}t|tst|drd
tt|}nd|}|S)zSParses `version` option value.

        :param value:
        :rtype: str

        zCVersion loaded from {value} does not comply with PEP 440: {version}__iter__rcz%s)rrgr r	rrr/rrr]callablerhasattrrmap)rr%rtmplrrrrs 


z$ConfigMetadataHandler._parse_version)FN)r2r3r4rWrpZstrict_moderrrnr
__classcell__rrrrr[s
r[c@sdeZdZdZeddZddZddZdd	Zd
dZ	dd
Z
ddZddZddZ
ddZdS)rZr_cCsV|j}t|jdd}|j}|j}|j}|||||||||||||||j|j|t|dS)rk;r)Zzip_safeZuse_2to3Zinclude_package_datar]Zuse_2to3_fixersZuse_2to3_exclude_fixersZconvert_2to3_doctestsscriptsZeager_resourcesZdependency_linksZnamespace_packagesZinstall_requiresZsetup_requiresZ
tests_requirepackagesentry_points
py_modulesZpython_requirescmdclass)rrrr_parse_cmdclass_parse_packagesrr
)rrZparse_list_semicolonZ
parse_boolrZparse_cmdclassrrrrn?s2zConfigOptionsHandler.parserscs$ddfdd||DS)NcSs8|d}||dd}|d|}t|}t||S)Nrcr)rfind
__import__rP)Zqualified_class_nameidx
class_namepkg_namerrrr
resolve_class_s

z;ConfigOptionsHandler._parse_cmdclass.<locals>.resolve_classcsi|]\}}||qSrrr&kvrrr
<dictcomp>hsz8ConfigOptionsHandler._parse_cmdclass.<locals>.<dictcomp>)rrd)rr%rrrr^s	
z$ConfigOptionsHandler._parse_cmdclasscCsjddg}|}||kr"||S||dk}||jdi}|rTddlm}nddlm}|f|S)zTParses `packages` option value.

        :param value:
        :rtype: list
        zfind:zfind_namespace:rz
packages.findr)find_namespace_packages)
find_packages)rgrparse_section_packages__findrhrq
setuptoolsrr)rr%Zfind_directivesZ
trimmed_valueZfindnsfind_kwargsrrrrrms
z$ConfigOptionsHandler._parse_packagescsT|||j}dddgtfdd|D}|d}|dk	rP|d|d<|S)zParses `packages.find` configuration file section.

        To be used in conjunction with _parse_packages().

        :param dict section_options:
        whereincludeexcludecs$g|]\}}|kr|r||fqSrrrZ
valid_keysrrr{szEConfigOptionsHandler.parse_section_packages__find.<locals>.<listcomp>Nr)rrrUrdrq)rrjZsection_datarrrrrrs

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

        :param dict section_options:
        rN)rrrrjrrrrparse_section_entry_pointssz/ConfigOptionsHandler.parse_section_entry_pointscCs.|||j}|d}|r*||d<|d=|S)N*rb)rrrq)rrjrrootrrr_parse_package_datas
z(ConfigOptionsHandler._parse_package_datacCs|||d<dS)z`Parses `package_data` configuration file section.

        :param dict section_options:
        package_dataNrrrjrrrparse_section_package_datasz/ConfigOptionsHandler.parse_section_package_datacCs|||d<dS)zhParses `exclude_package_data` configuration file section.

        :param dict section_options:
        Zexclude_package_dataNrrrrr"parse_section_exclude_package_datasz7ConfigOptionsHandler.parse_section_exclude_package_datacCs"t|jdd}||||d<dS)zbParses `extras_require` configuration file section.

        :param dict section_options:
        rrZextras_requireN)rrr)rrjrrrrparse_section_extras_requires
z1ConfigOptionsHandler.parse_section_extras_requirecCs(|||j}dd|D|d<dS)z^Parses `data_files` configuration file section.

        :param dict section_options:
        cSsg|]\}}||fqSrrrrrrr{szAConfigOptionsHandler.parse_section_data_files.<locals>.<listcomp>
data_filesN)rrrdrrrrparse_section_data_filessz-ConfigOptionsHandler.parse_section_data_filesN)r2r3r4rWrrnrrrrrrrrrrrrrrZ;s

	rZ)FF)F)rrr?r6rrOr
collectionsrrr
contextlibdistutils.errorsrrZ#setuptools.extern.packaging.versionrr	Z&setuptools.extern.packaging.specifiersr
rcontextmanagerr:rNrTrJrHrar[rZrrrr<module>s8

/
@[
Back to Directory File Manager