HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/setuptools/config/__pycache__/setupcfg.cpython-37.pyc
B

N��gHf�@s$dZddlZddlZddlZddlmZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZddlmZmZdd	lmZdd
lmZmZddlmZddl m!Z!m"Z"dd
l#m$Z$ddl%m&Z&e	r�ddl'm(Z(ddl)m*Z*ee+ej,fZ-ededeffZ.ede.fZ/ededd�Z0d;e-e1d�dd�Z2de-dd�dd�Z3d<de-ee-e4edd �d!d"�Z5e0e+d#�d$d%�Z6ede1d&�d'd(�Z7d=de/ed)d*�d+d,�Z8e+e+e9d-�d.d/�Z:Gd0d1�d1e
e0�Z;Gd2d3�d3e;d4�Z<Gd5d6�d6e;d�Z=Gd7d8�d8e$�Z>Gd9d:�d:e$�Z?dS)>a<
Load setuptools configuration from ``setup.cfg`` files.

**API will be made private in the future**

To read project metadata, consider using
``build.util.project_wheel_metadata`` (https://pypi.org/project/build/).
For simple scenarios, you can also try parsing the file directly
with the help of ``configparser``.
�N)�defaultdict)�partial)�wraps)�
TYPE_CHECKING�Callable�Any�Dict�Generic�Iterable�List�Optional�Set�Tuple�TypeVar�Union�)�	FileError�OptionError)�default_environment)�InvalidRequirement�Requirement)�SpecifierSet)�InvalidVersion�Version)�SetuptoolsDeprecationWarning�)�expand)�DistributionMetadata)�Distribution�str�Target)rr)�boundF)�filepath�returncCs8ddlm}|�}|r|��ng}t||||�}t|�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)r)�setuptools.distr�find_config_files�_apply�configuration_to_dict)r"Zfind_others�ignore_option_errorsr�dist�	filenames�handlers�r,�>/tmp/pip-unpacked-wheel-yrlplx0q/setuptools/config/setupcfg.py�read_configuration8s
r.r)r)r"r#cCst||�|��|S)z`Apply the configuration from a ``setup.cfg`` file into an existing
    distribution object.
    )r&Z_finalize_requires)r)r"r,r,r-�apply_configurationRs
r/r,)�
ConfigHandler.)r)r"�other_filesr(r#c	Cs�ddlm}tj�|�}tj�|�s4td|�d���t��}t�tj�	|��||f�}z*|j
||d�t||j|d�}|�
�Wdt�|�X|S)zHRead configuration from ``filepath`` and applies to the ``dist`` object.r)�
_DistributionzConfiguration file z does not exist.)r*)r(N)r$r2�os�path�abspath�isfiler�getcwd�chdir�dirname�parse_config_files�parse_configuration�command_optionsZ_finalize_license_files)r)r"r1r(r2Zcurrent_directoryr*r+r,r,r-r&[s
r&)�
target_obj�keycCs*d|��}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.
    �get_)�	functoolsr�getattr)r=r>Zgetter_nameZby_attribute�getterr,r,r-�_get_optionys
rC)r+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_optionsrCr=�section_prefix)r+Zconfig_dict�handler�option�valuer,r,r-r'�s
r')�ConfigMetadataHandler�ConfigOptionsHandler)�distributionr<r#c	Cstt�|��\}t||||�}|��|js0|j|_t|j||||j|j�}|��|j�	|j|j�WdQRX||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
    N)
r�EnsurePackagesDiscoveredrK�parse�package_dirrJ�metadata�src_root�_referenced_files�update)rLr<r(�ensure_discovered�options�metar,r,r-r;�s(r;)�label�
orig_value�parsedc
s�d|kst��dkrdSt���}y,t�d�}|j|krLtj|�dd�WnTtk
r�}z6t�fdd�|D��r�tj	|�dd�}t|�|�Wdd}~XYnXdS)amBecause users sometimes misinterpret this configuration:

    [options.extras_require]
    foo = bar;python_version<"4"

    It looks like one requirement with an environment marker
    but because there is no newline, it's parsed as two requirements
    with a semicolon as separator.

    Therefore, if:
        * input string does not contain a newline AND
        * parsed result contains two requirements AND
        * parsing of the two parts from the result ("<first>;<second>")
        leads in a valid Requirement with a valid marker
    a UserWarning is shown to inform the user about the possible problem.
    �
rNr)�field�reqc3s|]}�d�|�VqdS)rN)�
startswith)�.0�marker)rYr,r-�	<genexpr>�sz8_warn_accidental_env_marker_misconfig.<locals>.<genexpr>)
�len�
marker_env�keysr�name�_AmbiguousMarker�emitr�any�message)rWrXrY�markersr\�ex�msgr,)rYr-�%_warn_accidental_env_marker_misconfig�s

rlc@s�eZdZUdZeed<iZeeefed<ee	e
jd�dd�Ze
e	d�dd	��Zed
d��Zdd
�Ze
d)dd��Ze
dd��Ze
dd��Ze
dd��Zed�dd�Zed�dd�Ze
dd��Ze
dd��Ze
d*d!d"��Zd#d$�Zd%d&�Zd'd(�Zd S)+r0z1Handles metadata supplied in configuration files.rF�aliases)r=rUrTcCs4||_||_t|�|��|_g|_||_t�|_dS)N)	r(r=rD�_section_options�sectionsrErT�setrR)�selfr=rUr(rTr,r,r-�__init__�szConfigHandler.__init__)rUccsBx<|��D]0\}}|�|j�\}}}|r*q
|�d�|fVq
WdS)N�.)�items�	partitionrF�lstrip)�clsrUZ	full_namerI�pre�seprdr,r,r-rns
zConfigHandler._section_optionscCstd|jj��dS)z.Metadata item name to parser function mapping.z!%s must provide .parsers propertyN)�NotImplementedError�	__class__�__name__)rqr,r,r-�parsersszConfigHandler.parsersc	Cs�|j}|j�||�}yt||�}Wntk
r>t|��YnX|rHdSy|j�|dd��|�}Wntf|jk
r~dSXt	�
|j|�}t|d||�}||�|j�
|�dS)NcSs|S)Nr,)�xr,r,r-�<lambda>%�z+ConfigHandler.__setitem__.<locals>.<lambda>zset_%s)r=rm�getrA�AttributeError�KeyErrorr}�	Exceptionr(r@r�__setattr__rE�append)rqZoption_namerIr=Z
current_valuerYZ
simple_setter�setterr,r,r-�__setitem__s 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
        rZcSsg|]}|��r|���qSr,)�strip)r^�chunkr,r,r-�
<listcomp>Asz-ConfigHandler._parse_list.<locals>.<listcomp>)�
isinstance�list�
splitlines�split)rwrI�	separatorr,r,r-�_parse_list/s



zConfigHandler._parse_listcCsVd}i}xH|�|�D]:}|�|�\}}}||kr>td|����|��||��<qW|S)zPRepresents value as a dict.

        :param value:
        :rtype: dict
        �=z&Unable to parse option value to dict: )r�rurr�)rwrIr��result�liner>ry�valr,r,r-�_parse_dictCszConfigHandler._parse_dictcCs|��}|dkS)zQRepresents value as boolean.

        :param value:
        :rtype: bool
        )�1�true�yes)�lower)rwrIr,r,r-�_parse_boolTszConfigHandler._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]�
ValueError�format)rIZexclude_directive)r>r,r-�parserjs
z3ConfigHandler._exclude_files_parser.<locals>.parserr,)rwr>r�r,)r>r-�_exclude_files_parser^s	z#ConfigHandler._exclude_files_parser)�root_dircCs\d}t|t�s|S|�|�s |S|t|�d�}dd�|�d�D�}|j�|�t�||�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:NcSsg|]}|���qSr,)r�)r^r4r,r,r-r��sz-ConfigHandler._parse_file.<locals>.<listcomp>r�)	r�rr]rar�rRrSrZ
read_files)rqrIr�Zinclude_directive�specZ	filepathsr,r,r-�_parse_fileus


zConfigHandler._parse_filecCs:d}|�|�s|S|�|d�}|�|jj�t�|||�S)z�Represents value as a module attribute.

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

        :param str value:
        :rtype: str
        zattr:�)r]�replacerSrTrOrZ	read_attr)rqrIrOr�Zattr_directiveZ	attr_descr,r,r-�_parse_attr�s

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,)rIrY�method)�
parse_methodsr,r-rN�s
z1ConfigHandler._get_parser_compound.<locals>.parser,)rwr�rNr,)r�r-�_get_parser_compound�s
z"ConfigHandler._get_parser_compoundcCs0i}x&|��D]\}\}}|||�||<qW|S)aParses section options into a dictionary.

        Applies a given parser to each option in a section.

        :param dict section_options:
        :param callable values_parser: function with 2 args corresponding to key, value
        :rtype: dict
        )rt)rw�section_options�
values_parserrIr>�_r�r,r,r-�_parse_section_to_dict_with_key�s
z-ConfigHandler._parse_section_to_dict_with_keyNcs$�r�fdd�ndd�}|�||�S)aParses section options into a dictionary.

        Optionally applies a given parser to each value.

        :param dict section_options:
        :param callable values_parser: function with 1 arg corresponding to option value
        :rtype: dict
        cs�|�S)Nr,)r��v)r�r,r-r�r�z6ConfigHandler._parse_section_to_dict.<locals>.<lambda>cSs|S)Nr,)r�r�r,r,r-r�r�)r�)rwr�r�r�r,)r�r-�_parse_section_to_dict�s
z$ConfigHandler._parse_section_to_dictc
Cs<x6|��D]*\}\}}t�t��|||<WdQRXq
WdS)zQParses configuration file section.

        :param dict section_options:
        N)rt�
contextlib�suppressr�)rqr�rdr�rIr,r,r-�
parse_section�szConfigHandler.parse_sectioncCslxf|j��D]X\}}d}|r$d|}t|d|�dd�d�}|dkr\td|j�d|�d���||�qWdS)	zTParses configuration file items from one
        or more related sections.

        r�z_%szparse_section%srs�__Nz*Unsupported distribution option section: [�])rortrAr�rrF)rq�section_namer�Zmethod_postfixZsection_parser_methodr,r,r-rN�szConfigHandler.parsecst�����fdd��}|S)z�this function will wrap around parameters that are deprecated

        :param msg: deprecation message
        :param func: function to be wrapped around
        cs&��dd�tjd�f���||�S)N�
stacklevelrz Deprecated config in `setup.cfg`)�
setdefault�_DeprecatedConfigrf)�args�kwargs)�func�kwrkr,r-�config_handler�sz@ConfigHandler._deprecated_config_handler.<locals>.config_handler)r)rqr�rkr�r�r,)r�r�rkr-�_deprecated_config_handler�sz(ConfigHandler._deprecated_config_handler)r�)N)r|�
__module__�__qualname__�__doc__r�__annotations__rmrr �AllCommandOptionsrrMrr�classmethodrn�propertyr}r�r�r�r�r��_Pathr�r�r�r�r�r�rNr�r,r,r,r-r0�s0
	

r0csdeZdZdZddddd�ZdZdejfd	ee	e
jee
ed
��fdd�
Zed
d��Zdd�Z�ZS)rJrP�url�description�classifiers�	platforms)Z	home_page�summary�
classifier�platformFNr)r=rUr(rTrOr�cs"t��||||�||_||_dS)N)�superrrrOr�)rqr=rUr(rTrOr�)r{r,r-rrs	zConfigMetadataHandler.__init__cCsl|j}t|j|jd�}|j}|j}||||j|ddd�||�||�|d�|j|d�ddd�||||j|d�
S)	z.Metadata item name to parser function mapping.)r�z[The requires parameter is deprecated, please use install_requires for runtime dependencies.)i��
�)Zdue_date�license�license_filezDThe license_file parameter is deprecated, use license_files instead.)
r��keywords�provides�requires�	obsoletesr�r�r�Z
license_filesr��long_description�version�project_urls)	r�rr�r�r�r�r�r��_parse_version)rq�
parse_listZ
parse_file�
parse_dictZexclude_files_parserr,r,r-r}#s.
zConfigMetadataHandler.parserscCsp|�||j�}||krX|��}yt|�Wn(tk
rRtd|�d|����YnX|St�|�||j	|j��S)zSParses `version` option value.

        :param value:
        :rtype: str

        zVersion loaded from z does not comply with PEP 440: )
r�r�r�rrrrr�r�rO)rqrIr�r,r,r-r�Gsz$ConfigMetadataHandler._parse_version)r|r�r�rFrmZstrict_moder3�curdirr��boolrrMrrDr�rrr�r}r��
__classcell__r,r,)r{r-rJs($rJrcs�eZdZdZdeeejd��fdd�Ze	dd��Z
dd	�Zeed
�dd�Z
ed
d��Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Z�ZS)!rKrUr)r=rUr(rTcs$t��||||�|j|_i|_dS)N)r�rrrQr�rO)rqr=rUr(rT)r{r,r-rrdszConfigOptionsHandler.__init__cCs|j|dd�S)N�;)r�)r�)rwrIr,r,r-�_parse_list_semicolonosz*ConfigOptionsHandler._parse_list_semicoloncCs|j||jd�S)N)r�)r�r�)rqrIr,r,r-�_parse_file_in_rootssz(ConfigOptionsHandler._parse_file_in_root)rWrIcCs*|�|�|��}t|||�dd�|D�S)NcSsg|]}|�d�s|�qS)�#)r])r^r�r,r,r-r�|szAConfigOptionsHandler._parse_requirements_list.<locals>.<listcomp>)r�r�rl)rqrWrIrYr,r,r-�_parse_requirements_listvsz-ConfigOptionsHandler._parse_requirements_listcCsT|j}|j}|j}|j}|||||||�|d�t|jd�|j|j|j|j	|t
|d�S)z.Metadata item name to parser function mapping.zeThe namespace_packages parameter is deprecated, consider using implicit namespaces instead (PEP 420).�install_requires)Zzip_safeZinclude_package_datarO�scriptsZeager_resourcesZdependency_linksZnamespace_packagesr�Zsetup_requiresZ
tests_require�packages�entry_points�
py_modulesZpython_requires�cmdclass)r�r�r��_parse_cmdclassr�rr�r��_parse_packagesr�r)rqr�Z
parse_boolr�Zparse_cmdclassr,r,r-r}~s,zConfigOptionsHandler.parserscCs|jj}t�|�|�||j�S)N)rTrOrr�r�r�)rqrIrOr,r,r-r��sz$ConfigOptionsHandler._parse_cmdclasscCs^ddg}|��}||kr"|�|�S|�|j�di��}|j||dk|j|jd�tj	f|�S)zTParses `packages` option value.

        :param value:
        :rtype: list
        zfind:zfind_namespace:z
packages.findr)�
namespacesr�Zfill_package_dir)
r�r��parse_section_packages__findror�rSr�rOrZ
find_packages)rqrIZfind_directivesZ
trimmed_value�find_kwargsr,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,)r^�kr�)�
valid_keysr,r-r��szEConfigOptionsHandler.parse_section_packages__find.<locals>.<listcomp>Nr)r�r�rDrtr�)rqr�Zsection_datar�r�r,)r�r-r��s

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

        :param dict section_options:
        r�N)r�r�)rqr�rYr,r,r-�parse_section_entry_points�sz/ConfigOptionsHandler.parse_section_entry_pointscCs|�||j�}t�|�S)N)r�r�rZcanonic_package_data)rqr��package_datar,r,r-�_parse_package_data�sz(ConfigOptionsHandler._parse_package_datacCs|�|�|d<dS)z`Parses `package_data` configuration file section.

        :param dict section_options:
        r�N)r�)rqr�r,r,r-�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�)rqr�r,r,r-�"parse_section_exclude_package_data�sz7ConfigOptionsHandler.parse_section_exclude_package_datacs ��|�fdd��}|�d<dS)zbParses `extras_require` configuration file section.

        :param dict section_options:
        cs��d|�d�|�S)Nzextras_require[r�)r�)r�r�)rqr,r-r�r�zCConfigOptionsHandler.parse_section_extras_require.<locals>.<lambda>Zextras_requireN)r�)rqr�rYr,)rqr-�parse_section_extras_require�sz1ConfigOptionsHandler.parse_section_extras_requirecCs$|�||j�}t�||j�|d<dS)z^Parses `data_files` configuration file section.

        :param dict section_options:
        �
data_filesN)r�r�rZcanonic_data_filesr�)rqr�rYr,r,r-�parse_section_data_files�sz-ConfigOptionsHandler.parse_section_data_files)r|r�r�rFr�r�rrMrrr�r�r�rr�r�r}r�r�r�r�r�r�r�r�r�r�r,r,)r{r-rKas$!rKc@s$eZdZdZdZdZedd��ZdS)rezAmbiguous requirement marker.z�
    One of the parsed requirements in `{field}` looks like a valid environment marker:

        {req!r}

    Please make sure that the configuration file is correct.
    You can use dangling lines to avoid this problem.
    z'userguide/declarative_config.html#opt-2cKs"d|j��}|j|j|j||d�S)Nz%https://setuptools.pypa.io/en/latest/)Zsee_urlZformat_args)�	_SEE_DOCS�_format�_SUMMARY�_DETAILS)rwr�Zdocsr,r,r-rhsz_AmbiguousMarker.messageN)r|r�r�r�rr�r�rhr,r,r,r-resrec@seZdZdZdS)r�z!userguide/declarative_config.htmlN)r|r�r�r�r,r,r,r-r�sr�)FF)r,F)F)@r�r�r@r3�collectionsrrr�typingrrrrr	r
rrr
rrr�errorsrrZextern.packaging.markersrrbZextern.packaging.requirementsrrZextern.packaging.specifiersrZextern.packaging.versionrr�warningsrr�r�distutils.distrr$rr�PathLiker�ZSingleCommandOptionsr�r rDr.r/r�r&rCr'r;r�rlr0rJrKrer�r,r,r,r-�<module>
sP8* #[