%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/setuptools/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/setuptools/__pycache__/config.cpython-37.pyc

B

��aSZ�@sddlZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddl
Z
ddlmZmZddlmZmZddlmZGd	d
�d
�Ze
jdd��Zddd�Zdd�Zdd�Zddd�ZGdd�d�ZGdd�de�ZGdd�de�ZdS)�N)�defaultdict)�partial)�wraps)�iglob)�DistutilsOptionError�DistutilsFileError)�
LegacyVersion�parse)�SpecifierSetc@s eZdZdZdd�Zdd�ZdS)�StaticModulez0
    Attempt to load the module by the name
    c	CsLtj�|�}t|j��}|��}WdQRXt�|�}t|��	t
��|`dS)N)�	importlib�util�	find_spec�open�origin�read�astr	�vars�update�locals�self)r�name�specZstrm�src�module�r�B/opt/alt/python37/lib/python3.7/site-packages/setuptools/config.py�__init__s
zStaticModule.__init__c
sVyt�fdd�|jjD��Stk
rP}ztdjft���|�Wdd}~XYnXdS)Nc3sH|]@}t|tj�r|jD](}t|tj�r|j�krt�|j�VqqdS)N)�
isinstancerZAssignZtargets�Name�idZliteral_eval�value)�.0Z	statement�target)�attrrr�	<genexpr>$s
z+StaticModule.__getattr__.<locals>.<genexpr>z#{self.name} has no attribute {attr})�nextrZbody�	Exception�AttributeError�formatr)rr$�er)r$r�__getattr__!s
zStaticModule.__getattr__N)�__name__�
__module__�__qualname__�__doc__rr+rrrrrsrc	cs,ztj�d|�dVWdtj�|�XdS)zH
    Add path to front of sys.path for the duration of the context.
    rN)�sys�path�insert�remove)r1rrr�
patch_path0s
r4Fc		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.distr5r6�osr1�abspath�isfiler�getcwd�chdir�dirnameZfind_config_files�appendZparse_config_files�parse_configuration�command_options�configuration_to_dict)	�filepathZfind_othersr8r5r6Zcurrent_directoryZdistr7�handlersrrr�read_configuration<s 
rEcCs.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})r)r�	functoolsr�getattr)�
target_obj�keyZgetter_nameZby_attribute�getterrrr�_get_optionisrKcCsDtt�}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_optionsrKrH�section_prefix)rDZconfig_dictZhandlerZoptionr!rrrrBus
rBcCs6t|||�}|��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)ZdistributionrAr8�options�metarrrr@�sr@c@s�eZdZdZdZiZd'dd�Zedd��Zdd	�Z	e
d(dd��Ze
d)d
d��Ze
dd��Z
e
dd��Ze
dd��Ze
dd��Zedd��Zedd��Ze
d*dd��Ze
dd��Ze
d+dd ��Zd!d"�Zd#d$�Zd%d&�ZdS),�
ConfigHandlerz1Handles metadata supplied in configuration files.NFcCsbi}|j}x:|��D].\}}|�|�s(q|�|d��d�}|||<qW||_||_||_g|_dS)N��.)	rN�items�
startswith�replace�stripr8rH�sectionsrM)rrHrSr8r\rN�section_name�section_optionsrrrr�s
zConfigHandler.__init__cCstd|jj��dS)z.Metadata item name to parser function mapping.z!%s must provide .parsers propertyN)�NotImplementedError�	__class__r,)rrrr�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)�tuplerH�aliases�getrG�KeyErrorrar'r8�setattrrMr?)	rZoption_namer!�unknownrHZ
current_valueZskip_option�parser�setterrrr�__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[)r"�chunkrrr�
<listcomp>sz-ConfigHandler._parse_list.<locals>.<listcomp>)r�list�
splitlines�split)�clsr!�	separatorrrr�_parse_list�s



zConfigHandler._parse_listc	snd}|j�|d�}g}xR|D]J�t�fdd�|D��r\|�tdd�ttj����D���q|���qW|S)aEquivalent to _parse_list() but expands any glob patterns using glob().

        However, unlike with glob() calls, the results remain relative paths.

        :param value:
        :param separator: List items separator character.
        :rtype: list
        )�*�?�[�]�{�})rsc3s|]}|�kVqdS)Nr)r"�char)r!rrr%sz1ConfigHandler._parse_list_glob.<locals>.<genexpr>css |]}tj�|t���VqdS)N)r9r1�relpathr<)r"r1rrrr%s)	rt�any�extend�sortedrr9r1r:r?)rrr!rsZglob_characters�valuesZexpanded_valuesr)r!r�_parse_list_globs

zConfigHandler._parse_list_globcCsTd}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)rt�	partitionrr[)rrr!rs�result�linerI�sep�valrrr�_parse_dict s
zConfigHandler._parse_dictcCs|��}|dkS)zQRepresents value as boolean.

        :param value:
        :rtype: bool
        )�1�trueZyes)�lower)rrr!rrr�_parse_bool3szConfigHandler._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)rY�
ValueErrorr))r!Zexclude_directive)rIrrrhIs
z3ConfigHandler._exclude_files_parser.<locals>.parserr)rrrIrhr)rIr�_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)r9r1r:r[)r"r1rrrr%ksz,ConfigHandler._parse_file.<locals>.<genexpr>rkrlc3s.|]&}��|�stj�|�r��|�VqdS)TN)�
_assert_localr9r1r;�
_read_file)r"r1)rrrrr%ms)r�strrY�lenrq�join)rrr!Zinclude_directiverZ	filepathsr)rrr�_parse_fileTs


zConfigHandler._parse_filecCs|�t���std|��dS)Nz#`file:` directive can not access %s)rYr9r<r)rCrrrr�rszConfigHandler._assert_localc	Cs"tj|dd��
}|��SQRXdS)Nzutf-8)�encoding)�iorr)rC�frrrr�wszConfigHandler._read_filec	Csd}|�|�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�}t|��4ytt
|�|�Stk
r�t�|�}
YnXWdQRXt|
|�S)	z�Represents value as a module attribute.

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

        :param str value:
        :rtype: str
        zattr:rVrWrr�/�N)rYrZr[rq�popr�r9r<�rsplitr�r1r4rGrr'r�
import_module)rrr!rRZattr_directiveZ
attrs_pathZ	attr_nameZmodule_name�parent_pathZcustom_path�partsrrrr�_parse_attr|s0



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)r!�parsed�method)�
parse_methodsrrr	�s
z1ConfigHandler._get_parser_compound.<locals>.parser)rrr�r	r)r�r�_get_parser_compound�s
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)r�rrr�<lambda>��z6ConfigHandler._parse_section_to_dict.<locals>.<lambda>)rX)rrr^Z
values_parserr!rI�_r�rrr�_parse_section_to_dict�s

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

        :param dict section_options:
        N)rXre)rr^rr�r!rrr�
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.

        rVz_%szparse_section%srW�__Nz0Unsupported distribution option section: [%s.%s])r\rXrGrZrrN)rr]r^Zmethod_postfixZsection_parser_methodrrrr	�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_classrr�config_handler�sz@ConfigHandler._deprecated_config_handler.<locals>.config_handler)r)rr�r�r�r�r)r�r�r�r�_deprecated_config_handler�sz(ConfigHandler._deprecated_config_handler)F)rk)rk)N)N)r,r-r.r/rNrcr�propertyrarj�classmethodrtr�r�r�r�r��staticmethodr�r�r�r�r�r�r	r�rrrrrU�s0
&
-rUcsHeZdZdZddddd�ZdZd�fd	d
�	Zedd��Zd
d�Z	�Z
S)rPrQZurl�description�classifiers�	platforms)Z	home_pageZsummaryZ
classifier�platformFNcstt|��|||�||_dS)N)�superrPrrR)rrHrSr8rR)r`rrrs

zConfigMetadataHandler.__init__cCs^|j}|j}|j}|j}||||�|dt�||�||�|d�|�|d�dt�||||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�license_filezDThe license_file parameter is deprecated, use license_files instead.)
r��keywordsZprovidesZrequiresZ	obsoletesr�r�r�Z
license_filesr�Zlong_description�versionZproject_urls)rtr�r�r�r��DeprecationWarningr��_parse_version)r�
parse_listZ
parse_file�
parse_dictZexclude_files_parserrrrras.
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__rWz%s)r�r[rr	rrr)rr�rR�callabler��hasattrr��map)rr!r�Ztmplrrrr�?s


z$ConfigMetadataHandler._parse_version)FN)r,r-r.rNrcZstrict_moderr�rar��
__classcell__rr)r`rrPs"rPc@sdeZdZdZedd��Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�ZdS)rOrScCsN|j}t|jdd�}|j}|j}|j}|||||||||||j|j|t|d�S)z.Metadata item name to parser function mapping.�;)rs)Zzip_safeZinclude_package_datarRZscriptsZeager_resourcesZdependency_linksZnamespace_packagesZinstall_requiresZsetup_requiresZ
tests_requireZpackages�entry_pointsZ
py_modulesZpython_requiresZcmdclass)rtrr�r��_parse_cmdclass�_parse_packagesr�r
)rr�Zparse_list_semicolonZ
parse_boolr�Zparse_cmdclassrrrrags(zConfigOptionsHandler.parserscs$dd���fdd�|�|���D�S)NcSs8|�d�}||dd�}|d|�}t|�}t||�S)NrWr�)�rfind�
__import__rG)Zqualified_class_name�idx�
class_nameZpkg_namerrrr�
resolve_class�s

z;ConfigOptionsHandler._parse_cmdclass.<locals>.resolve_classcsi|]\}}�|�|�qSrr)r"�k�v)r�rr�
<dictcomp>�sz8ConfigOptionsHandler._parse_cmdclass.<locals>.<dictcomp>)r�rX)rr!r)r�rr��s	z$ConfigOptionsHandler._parse_cmdclasscCsjddg}|��}||kr"|�|�S||dk}|�|j�di��}|rTddlm}nddlm}|f|�S)zTParses `packages` option value.

        :param value:
        :rtype: list
        zfind:zfind_namespace:r�z
packages.findr)�find_namespace_packages)�
find_packages)r[rt�parse_section_packages__findr\rdZ
setuptoolsr�r�)rr!Zfind_directivesZ
trimmed_valueZfindns�find_kwargsr�rrrr��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:
        �whereZincludeZexcludecs$g|]\}}|�kr|r||f�qSrr)r"r�r�)�
valid_keysrrrn�szEConfigOptionsHandler.parse_section_packages__find.<locals>.<listcomp>Nr)r�rtrLrXrd)rr^Zsection_datar�r�r)r�rr��s

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

        :param dict section_options:
        r�N)r�rt)rr^r�rrr�parse_section_entry_points�sz/ConfigOptionsHandler.parse_section_entry_pointscCs.|�||j�}|�d�}|r*||d<|d=|S)NrurV)r�rtrd)rr^r��rootrrr�_parse_package_data�s
z(ConfigOptionsHandler._parse_package_datacCs|�|�|d<dS)z`Parses `package_data` configuration file section.

        :param dict section_options:
        Zpackage_dataN)r�)rr^rrr�parse_section_package_data�sz/ConfigOptionsHandler.parse_section_package_datacCs|�|�|d<dS)zhParses `exclude_package_data` configuration file section.

        :param dict section_options:
        Zexclude_package_dataN)r�)rr^rrr�"parse_section_exclude_package_data�sz7ConfigOptionsHandler.parse_section_exclude_package_datacCs"t|jdd�}|�||�|d<dS)zbParses `extras_require` configuration file section.

        :param dict section_options:
        r�)rsZextras_requireN)rrtr�)rr^r�rrr�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�qSrr)r"r�r�rrrrn�szAConfigOptionsHandler.parse_section_data_files.<locals>.<listcomp>Z
data_filesN)r�r�rX)rr^r�rrr�parse_section_data_files�sz-ConfigOptionsHandler.parse_section_data_filesN)r,r-r.rNr�rar�r�r�r�r�r�r�r�r�rrrrrOcs

rO)FF)F) rr�r9r0r�rFr�collectionsrrrZglobr�
contextlibZdistutils.errorsrrZ#setuptools.extern.packaging.versionrr	Z&setuptools.extern.packaging.specifiersr
r�contextmanagerr4rErKrBr@rUrPrOrrrr�<module>s2
-
c_

Zerion Mini Shell 1.0