HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/setuptools/__pycache__/build_meta.cpython-310.pyc
o

�N�g{N�@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZmZmZddlZddlZddlmZddlmZddlmZdd	l	mZdd
lmZgd�Ze�dd
���Z de �!dd�vZ"Gdd�de#�Z$Gdd�dej%j&�Z&ej'dd��Z(dd�Z)dd�Z*dd�Z+ej'dd��Z,ee
e-ee-ee-dffZ.	Gdd �d �Z/Gd!d"�d"e/�Z0Gd#d$�d$e0�Z1e0�Z2e2j3Z3e2j4Z4e2j5Z5e2j6Z6e2j7Z7e"s�e2j8Z8e2j9Z9e2j:Z:e1�Z;dS)%a-A PEP 517 interface to setuptools

Previously, when a user or a command line tool (let's call it a "frontend")
needed to make a request of setuptools to take a certain action, for
example, generating a list of installation requirements, the frontend would
would call "setup.py egg_info" or "setup.py bdist_wheel" on the command line.

PEP 517 defines a different method of interfacing with setuptools. Rather
than calling "setup.py" directly, the frontend should:

  1. Set the current directory to the directory with a setup.py file
  2. Import this module into a safe python interpreter (one in which
     setuptools can potentially set global variables or crash hard).
  3. Call one of the functions defined in PEP 517.

What each function does is defined in PEP 517. However, here is a "casual"
definition of the functions (this definition should not be relied on for
bug reports or API stability):

  - `build_wheel`: build a wheel in the folder and return the basename
  - `get_requires_for_build_wheel`: get the `setup_requires` to build
  - `prepare_metadata_for_build_wheel`: get the `install_requires`
  - `build_sdist`: build an sdist in the folder and return the basename
  - `get_requires_for_build_sdist`: get the `setup_requires` to build

Again, this is not a formal definition! Just a "taste" of the module.
�N)�Path)�Dict�Iterator�List�Optional�Union�)�errors)�	same_path)�
parse_strings)�SetuptoolsDeprecationWarning)�	strtobool)
�get_requires_for_build_sdist�get_requires_for_build_wheel� prepare_metadata_for_build_wheel�build_wheel�build_sdist�get_requires_for_build_editable�#prepare_metadata_for_build_editable�build_editable�
__legacy__�SetupRequirementsError�SETUPTOOLS_ENABLE_FEATURES�zlegacy-editable�_�-c@seZdZdd�ZdS)rcCs
||_dS�N)�
specifiers)�selfr�r�I/opt/saltstack/salt/lib/python3.10/site-packages/setuptools/build_meta.py�__init__D�
zSetupRequirementsError.__init__N)�__name__�
__module__�__qualname__r!rrrr rCsrc@s&eZdZdd�Zeejdd���ZdS)�DistributioncCstt|��}t|��r)�listrr)rrZspecifier_listrrr �fetch_build_eggsIszDistribution.fetch_build_eggsccs2�tjj}|tj_z
dVW|tj_dS|tj_w)zw
        Replace
        distutils.dist.Distribution with this class
        for the duration of this context.
        N)�	distutils�corer&)�cls�origrrr �patchNs�zDistribution.patchN)r#r$r%r(�classmethod�
contextlib�contextmanagerr-rrrr r&Hs
r&ccs.�tj}dd�t_z	dVW|t_dS|t_w)a
Temporarily disable installing setup_requires

    Under PEP 517, the backend reports build dependencies to the frontend,
    and the frontend is responsible for ensuring they're installed.
    So setuptools (acting as a backend) should not try to install them.
    cSsdSrr)Zattrsrrr �<lambda>gsz+no_install_setup_requires.<locals>.<lambda>N)�
setuptoolsZ_install_setup_requires)r,rrr �no_install_setup_requires^s�
r3cs�fdd�t���D�S)Ncs&g|]}tj�tj��|��r|�qSr)�os�path�isdir�join)�.0�name�Za_dirrr �
<listcomp>os
��z1_get_immediate_subdirectories.<locals>.<listcomp>)r4�listdirr:rr:r �_get_immediate_subdirectoriesns
�r=cs<�fdd�t�|�D�}z|\}W|Stytd��w)Nc3s�|]
}|���r|VqdSr��endswith�r8�f��	extensionrr �	<genexpr>us�z'_file_with_extension.<locals>.<genexpr>z[No distribution was found. Ensure that `setup.py` is not empty and that it calls `setup()`.)r4r<�
ValueError)�	directoryrCZmatching�filerrBr �_file_with_extensionts���rHcCs&tj�|�st�d�Sttdt�|�S)Nz%from setuptools import setup; setup()�open)r4r5�exists�io�StringIO�getattr�tokenizerI��setup_scriptrrr �_open_setup_script�s
rQccsB�t���t�dd�dVWd�dS1swYdS)N�ignorezsetup.py install is deprecated)�warnings�catch_warnings�filterwarningsrrrr �suppress_known_deprecation�s
�
"�rVc@s�eZdZdZdededeefdd�Zdd�Zdede	efd	d
�Z
dede	efdd�Zdede	efd
d�Zdede	efdd�Z
dS)�_ConfigSettingsTranslatorz�Translate ``config_settings`` into distutils-style command arguments.
    Only a limited number of options is currently supported.
    �key�config_settings�returncCs.|pi}|�|�p
g}t|t�rt�|�S|S)aA
        Get the value of a specific key in ``config_settings`` as a list of strings.

        >>> fn = _ConfigSettingsTranslator()._get_config
        >>> fn("--global-option", None)
        []
        >>> fn("--global-option", {})
        []
        >>> fn("--global-option", {'--global-option': 'foo'})
        ['foo']
        >>> fn("--global-option", {'--global-option': ['foo']})
        ['foo']
        >>> fn("--global-option", {'--global-option': 'foo'})
        ['foo']
        >>> fn("--global-option", {'--global-option': 'foo bar'})
        ['foo', 'bar']
        )�get�
isinstance�str�shlex�split)rrXrY�cfg�optsrrr �_get_config�sz%_ConfigSettingsTranslator._get_configcCs"dd�tjjjD�}dd�|D�S)z>Global options accepted by setuptools (e.g. quiet or verbose).css�|]	}|dd�VqdS)N�r)r8�optrrr rD�s�zB_ConfigSettingsTranslator._valid_global_options.<locals>.<genexpr>cSsh|]}|D]}|r|�qqSrr)r8Zlong_and_short�flagrrr �	<setcomp>�szB_ConfigSettingsTranslator._valid_global_options.<locals>.<setcomp>)r2�distr&�global_options)r�optionsrrr �_valid_global_options�sz/_ConfigSettingsTranslator._valid_global_optionsc#s��|pi}hd�}d|vsd|vr*t|�d�p|�d�pd�}|��|vr'dndVd|vs2d|vrKt|�d�p>|�d�p>d�}|��|vrHdndV|���|�d	|�}�fd
d�|D�EdHdS)
a�
        Let the user specify ``verbose`` or ``quiet`` + escape hatch via
        ``--global-option``.
        Note: ``-v``, ``-vv``, ``-vvv`` have similar effects in setuptools,
        so we just have to cover the basic scenario ``-v``.

        >>> fn = _ConfigSettingsTranslator()._global_args
        >>> list(fn(None))
        []
        >>> list(fn({"verbose": "False"}))
        ['-q']
        >>> list(fn({"verbose": "1"}))
        ['-v']
        >>> list(fn({"--verbose": None}))
        ['-v']
        >>> list(fn({"verbose": "true", "--global-option": "-q --no-user-cfg"}))
        ['-v', '-q', '--no-user-cfg']
        >>> list(fn({"--quiet": None}))
        ['-q']
        >�no�false�0Zoff�verbosez	--verbose�1z-qz-v�quietz--quiet�--global-optionc3s"�|]}|�d��vr|VqdS)rN)�strip)r8�arg�Zvalidrr rD�s� z9_ConfigSettingsTranslator._global_args.<locals>.<genexpr>N)r]r[�lowerrjrb)rrYr`Zfalsey�level�argsrrtr �_global_args�s�z&_ConfigSettingsTranslator._global_argsccsZ�|pi}d|vrtt|dpd��}|rdndVd|vr+dt|d�gEdHdSdS)a�
        The ``dist_info`` command accepts ``tag-date`` and ``tag-build``.

        .. warning::
           We cannot use this yet as it requires the ``sdist`` and ``bdist_wheel``
           commands run in ``build_sdist`` and ``build_wheel`` to reuse the egg-info
           directory created in ``prepare_metadata_for_build_wheel``.

        >>> fn = _ConfigSettingsTranslator()._ConfigSettingsTranslator__dist_info_args
        >>> list(fn(None))
        []
        >>> list(fn({"tag-date": "False"}))
        ['--no-date']
        >>> list(fn({"tag-date": None}))
        ['--no-date']
        >>> list(fn({"tag-date": "true", "tag-build": ".a"}))
        ['--tag-date', '--tag-build', '.a']
        ztag-daterlz
--tag-datez	--no-datez	tag-buildz--tag-buildN)r
r])rrYr`�valrrr Z__dist_info_args�s��z*_ConfigSettingsTranslator.__dist_info_argsccs<�|pi}|�d�p|�d�}|sdSdt|�gEdHdS)a
        The ``editable_wheel`` command accepts ``editable-mode=strict``.

        >>> fn = _ConfigSettingsTranslator()._editable_args
        >>> list(fn(None))
        []
        >>> list(fn({"editable-mode": "strict"}))
        ['--mode', 'strict']
        z
editable-modeZ
editable_modeNz--mode)r[r])rrYr`�moderrr �_editable_args�s�
z(_ConfigSettingsTranslator._editable_argsccsx�|�d|�}|��}g}|D]}|�d�|vr |�|�|Vq|�d|�EdH|r:tjdd|�d�dd	�dSdS)
aV
        Users may expect to pass arbitrary lists of arguments to a command
        via "--global-option" (example provided in PEP 517 of a "escape hatch").

        >>> fn = _ConfigSettingsTranslator()._arbitrary_args
        >>> list(fn(None))
        []
        >>> list(fn({}))
        []
        >>> list(fn({'--build-option': 'foo'}))
        ['foo']
        >>> list(fn({'--build-option': ['foo']}))
        ['foo']
        >>> list(fn({'--build-option': 'foo'}))
        ['foo']
        >>> list(fn({'--build-option': 'foo bar'}))
        ['foo', 'bar']
        >>> warnings.simplefilter('error', SetuptoolsDeprecationWarning)
        >>> list(fn({'--global-option': 'foo'}))  # doctest: +IGNORE_EXCEPTION_DETAIL
        Traceback (most recent call last):
        SetuptoolsDeprecationWarning: ...arguments given via `--global-option`...
        rqrz--build-optionNz7Incompatible `config_settings` passed to build backend.z
                The arguments z� were given via `--global-option`.
                Please use `--build-option` instead,
                `--global-option` is reserved for flags like `--verbose` or `--quiet`.
                )i��	�)Zdue_date)rbrjrr�appendr�emit)rrYrwZglobal_optsZbad_argsrsrrr �_arbitrary_args
s&�
��
��z)_ConfigSettingsTranslator._arbitrary_argsN)r#r$r%�__doc__r]�_ConfigSettingsrrbrjrrxZ)_ConfigSettingsTranslator__dist_info_argsr{r�rrrr rW�s"rWc@s�eZdZdd�Zd"dd�Zd#dd�Zd#d	d
�Zdeded
efdd�Zdeded
e	fdd�Z
	d#dd�Zdd�Z	d$dd�Z
d#dd�Zdeed
eefdd�Zesd	d$dd�Zd#dd�Z	d#d d!�ZdSdS)%�_BuildMetaBackendc
Cs�gtjdd��|�|��d�|�|��t_zt���|��Wd�W|S1s,wYW|StyK}z||j7}WYd}~|Sd}~ww)NrZegg_info)	�sys�argvrxr�r&r-�	run_setuprr)rrY�requirements�errr �_get_build_requires<s*����

�����z%_BuildMetaBackend._get_build_requires�setup.pyc
Cs�tj�|�}d}t|��}|���dd�}Wd�n1swYz	t|t��WdStyL}z|j	r9�t
jdddd�WYd}~dSd}~ww)N�__main__z\r\nz\nz6Running `setup.py` directly as CLI tool is deprecated.znPlease avoid using `sys.exit(0)` or similar statements that don't fit in the paradigm of a configuration file.zAhttps://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html)Zsee_url)r4r5�abspathrQ�read�replace�exec�locals�
SystemExit�coderr)rrP�__file__r#rAr�r�rrr r�Ks"
����z_BuildMetaBackend.run_setupNcCs|j|dgd�S)NZwheel�r��r��rrYrrr rbsz._BuildMetaBackend.get_requires_for_build_wheelcCs|j|gd�S)Nr�r�r�rrr resz._BuildMetaBackend.get_requires_for_build_sdist�metadata_directory�suffixrZcCs.|�||�}t|j|�st�t|�|�|jS)z�
        PEP 517 requires that the .dist-info directory be placed in the
        metadata_directory. To comply, we MUST copy the directory to the root.

        Returns the basename of the info directory, e.g. `proj-0.0.0.dist-info`.
        )�_find_info_directoryr
�parent�shutil�mover]r9)rr�r��info_dirrrr �_bubble_up_info_directoryhsz+_BuildMetaBackend._bubble_up_info_directorycs�t�|�D]1\}}}�fdd�|D�}t|�dkst|�dkr6t|�dks-Jd��d���t||d�Sqd��d|��}t�|��)	Ncsg|]	}|���r|�qSrr>r@�r�rr r;wsz:_BuildMetaBackend._find_info_directory.<locals>.<listcomp>rrz	Multiple z directories foundzNo z directory found in )r4�walk�lenrr	Z
InternalError)rr�r�r��dirsrZ
candidates�msgrr�r r�us�
z&_BuildMetaBackend._find_info_directorycCstgtjdd��|�|��d�d�|�d�t_t��|��Wd�n1s)wY|�|d�|�|d�S)NrZ	dist_infoz--output-dirz--keep-egg-infoz	.egg-infoz
.dist-info)r�r�rxr3r�r��rr�rYrrr r�s$������
�z2_BuildMetaBackend.prepare_metadata_for_build_wheelc		Cstj�|�}tj|dd�d|d�}tjdi|���\}gtjdd��|�|��|�d�|�|�	|��t_t
��|��Wd�n1sGwYt||�}tj�
||�}tj�|�rct�|�t�tj�
||�|�Wd�|S1sywY|S)NT)�exist_okz.tmp-)�prefix�dirrz
--dist-dirr)r4r5r��makedirs�tempfileZTemporaryDirectoryr�r�rxr�r3r�rHr7rJ�remove�rename)	rZ
setup_commandZresult_extensionZresult_directoryrYZ	temp_optsZtmp_dist_dirZresult_basename�result_pathrrr �_build_with_temp_dir�s:
������
�


��z&_BuildMetaBackend._build_with_temp_dircCs<t��|�dgd||�Wd�S1swYdS)NZbdist_wheel�.whl)rVr�)r�wheel_directoryrYr�rrr r�s

�$�z_BuildMetaBackend.build_wheelcCs|�gd�d||�S)N)Zsdistz	--formats�gztarz.tar.gz)r�)rZsdist_directoryrYrrr r�s�z_BuildMetaBackend.build_sdistcCs>|sdStt|��d��}t|�dksJ�|rt|d�SdS)Nz*.dist-inforr)r'r�globr�r])rr�Zdist_info_candidatesrrr �_get_dist_info_dir�s
z$_BuildMetaBackend._get_dist_info_dircCsh|�|�}|rd|gng}dg|�|�|��}t��|�|d||�Wd�S1s-wYdS)Nz--dist-info-dirZeditable_wheelr�)r�r{rVr�)rr�rYr�r�ra�cmdrrr r�s
�$�z _BuildMetaBackend.build_editablecCs
|�|�Sr)rr�rrr r�r"z1_BuildMetaBackend.get_requires_for_build_editablecCs|�||�Sr)rr�rrr r�s�z5_BuildMetaBackend.prepare_metadata_for_build_editable�r�r)NN)r#r$r%r�r�rrr]r�rr�rr�rrrr��LEGACY_EDITABLErrrrrrr r�;s*




�
�

�
��r�cs"eZdZdZd�fdd�	Z�ZS)�_BuildMetaLegacyBackendaOCompatibility backend for setuptools

    This is a version of setuptools.build_meta that endeavors
    to maintain backwards
    compatibility with pre-PEP 517 modes of invocation. It
    exists as a temporary
    bridge between the old packaging mechanism and the new
    packaging mechanism,
    and will eventually be removed.
    r�c
s�ttj�}tj�tj�|��}|tjvrtj�d|�tjd}|tjd<ztt	|�j
|d�W|tjdd�<|tjd<dS|tjdd�<|tjd<w)NrrO)r'r�r5r4�dirnamer��insertr��superr�r�)rrPZsys_pathZ
script_dirZ
sys_argv_0��	__class__rr r��s



�z!_BuildMetaLegacyBackend.run_setupr�)r#r$r%r�r��
__classcell__rrr�r r��sr�)<r�rKr4r^r�rNr�r/r�rS�pathlibr�typingrrrrrr2r)rr	�_pathr
Z_reqsrrZdistutils.utilr
�__all__�getenvrurr�r��
BaseExceptionrrgr&r0r3r=rHrQrVr]r�rWr�r�Z_BACKENDrrrrrrrrrrrrr �<module>sb


$)