HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/setuptools/tests/__pycache__/fixtures.cpython-310.pyc
o

��h�-�@stddlZddlZddlZddlZddlZddlZddlZddlmZddl	Z
ddlZddlZddl
mZddlmZmZddlmZejdd��Zejd	d
��Zejddd
�dd��Zejdd��Zejdd��Zdd�Zejdd�dd��Zejdd�dd��Zejdd��Zejdd��Zejdd ��Zd!d"�Z d#d$�Z!d%d&�Z"d'd(�Z#d)d*e!ddd+fd,d-�Z$ejd.d/��Z%dS)0�N)�Path)�
safer_name�)�contexts�environment)�DALSc
cs��t���H}|�d|�t���%}|�d|�t���dVWd�n1s)wYWd�n1s8wYWd�dSWd�dS1sPwYdS)za
    Override site.USER_BASE and site.USER_SITE with temporary directories in
    a context.
    zsite.USER_BASEzsite.USER_SITEN)r�tempdir�setattr�save_user_site_setting)�monkeypatch�	user_base�	user_site�r�D/usr/local/lib/python3.10/dist-packages/setuptools/tests/fixtures.py�
user_overrides�


����"�rccs6�|���}|VWd�dS1swYdS�N)�as_cwd)�tmpdir�origrrr�
tmpdir_cwd"s�
"�rT�session)�autouse�scopecCsN|jj�d�s	dSt�t��tj�d�Wd�dS1s wYdS)z�
    Workaround pytest-dev/pytest-xdist#376

    ``pytest-xdist`` tends to inject '' into ``sys.path``,
    which may break certain isolation expectations.
    Remove the entry so the import
    machinery behaves the same irrespective of xdist.
    �xdistN�)	�config�
pluginmanager�
has_plugin�
contextlib�suppress�
ValueError�sys�path�remove)�requestrrr�workaround_xdist_376(s

"�r%cCsHgd�}ztj|t|�d�W|dSty#t�d�Y|dSw)z<
    Clone the 'sampleproject' and return a path to it.
    )�git�clonez%https://github.com/pypa/sampleproject)�cwdzUnable to clone sampleproject�
sampleproject)�
subprocess�
check_call�str�	Exception�pytest�skip)�tmp_path�cmdrrr�sample_project9s��r2ccs8�t�|��dVWd�dS1swYdSr)r"r)r2rrr�sample_project_cwdFs�"�r3c
Cs�t�||d��]}t|�d�d�}t|�d�d�}|r'|r'||fWd�St|jjd���r2J�t�	t
jdddt|�t|jj�g�t|jjd���rOJ�t|�d��t|�d��fWd�S1sgwYdS)N�
dist_buildz*.tar.gzz*.whlzbuild/lib/build�-m�buildz--outdir)
r�session_locked_tmp_dir�next�globrr�rootdir�existsr*�check_outputr!�
executabler,)�tmp_path_factoryr$�tmp�sdist�wheelrrr�_build_distributionsTs*��	
�
$�rB)rcCs8t�d�}|rtj�|�rt|���St||�\}}|S)N�PRE_BUILT_SETUPTOOLS_SDIST��os�getenvr"r;r�resolverB)r>r$�prebuiltr@�_rrr�setuptools_sdisto�

rJcCs8t�d�}|rtj�|�rt|���St||�\}}|S)N�PRE_BUILT_SETUPTOOLS_WHEELrD)r>r$rHrIrArrr�setuptools_wheelyrKrMcCsdt��}t�|d�|_ddg|_t|�|_tjdd��|�	�Wd�S1s+wYdS)z?Virtual env with the version of setuptools under test installed�venv�--no-setuptoolsz--wheel=bundleN)�
PYTHONPATH)
r�
VirtualEnvr"r�root�create_optsr,�reqr�create)r0rM�envrrrrN�s

$�rNcCs.t��}t�|d�|_ddg|_|��|S)z7Virtual env without any version of setuptools installed�venv_without_setuptoolsrO�
--no-wheel�rrQr"rrRrS�
ensure_env�r0rVrrrrW��

rWcCs.t��}t�|d�|_gd�|_|��|S)z1Virtual env without any common packages installed�	bare_venv)rOz--no-piprXz	--no-seedrYr[rrrr]�r\r]cCs�t|�dksJ�t�|d��3}|D]'\}}t�|�d��}tj|d�}t|���|_t	t
�
��|_|j||d�qWd�dS1sDwYdS)z�
    Create a simple sdist tarball at dist_path, containing the files
    listed in ``files`` as ``(filename, content)`` tuples.
    rzw:gz�utf-8)�name)�fileobjN)
�len�tarfile�open�io�BytesIO�encode�TarInfo�getvalue�size�int�time�mtime�addfile)�	dist_path�files�dist�filename�content�
file_bytes�	file_inforrr�
make_sdist�s�"�ruc	Cs(t|dtd|�d|�d��fdg�dS)z\
    Create a simple sdist tarball at dist_path, containing just a simple
    setup.py.
    �setup.pyzT             import setuptools
             setuptools.setup(
                 name=z,
                 version=z
             )
         ��	setup.cfgrN)rur)rn�distname�versionrrr�make_trivial_sdist�s������r{c

s�d|vsJ�|�d���d}�fdd�tdt��d�D�}td|�d|�d|�d	|�d
�	�}d}d|ftj�|d
�|fg}|dd�D]}tjj|�d�d
g�}	|�|	df�qEt||�dS)z�
    Make an sdist tarball with distname and version which also contains one
    package with the same name as distname.  The top-level package is
    designated a namespace package).
    �.rcsg|]}d��d|���qS)r|N)�join)�.0�idx��partsrr�
<listcomp>�sz$make_nspkg_sdist.<locals>.<listcomp>rzE        import setuptools
        setuptools.setup(
            name=z,
            version=z,
            packages=z",
            namespace_packages=[z]
        )
    z7__import__('pkg_resources').declare_namespace(__name__)rv�__init__.pyNr)	�split�rangerarrEr"r}�appendru)
rnryrz�	nspackage�packages�setup_py�initro�packagerqrr�r�make_nspkg_sdist�s*
 �����r�cCs&t|dtd�j|||d�fdg�dS)Nrvz�                import setuptools
                setuptools.setup(
                  name={name!r},
                  version={version!r},
                  python_requires={python_requires!r},
                )
                )r_rz�python_requiresrw)rur�format)rnryrzr�rrr�make_python_requires_sdist�s�	����r��foobarz0.1rcCs�t|�}dd|�d|��gtj�|�gd�}|r|�|�tj�|d�}	t�|	�|rjg}
g}|D](}|�|�}
|d��vrA|}n|
}t	|
t
tf�rOd�|
�}
|�|�d|
���q1t
d�jd	�|
�d	�|�d
�}nd}ttj�|	d�d
dd��
}|�|�Wd�n1s�wY|dur�t
d�}ttj�|	d�d
dd��}|�||�Wd�n1s�wYtj�||�d|�d��}||||�|	S)a�Creates a source tree under path for a trivial test package that has a
    single requirement in setup_requires--a tarball for that requirement is
    also created and added to the dependency_links argument.

    ``distname`` and ``version`` refer to the name/version of the package that
    the test package requires via ``setup_requires``.  The name of the test
    package itself is just 'test_pkg'.
    �test_pkgz0.0z==)r_rz�setup_requires�dependency_linkszname version�;z: zg
            [metadata]
            {metadata}
            [options]
            {options}
            �
)�options�metadatarrx�wr^)�encodingNzI            import setuptools
            setuptools.setup(**%r)
        rv�-z.tar.gz)rrEr"�abspath�updater}�mkdir�popr��
isinstance�tuple�listr�rr�rc�write)r"ryrz�make_package�setup_py_template�setup_attrs�
use_setup_cfg�normalized_distname�test_setup_attrsr�r�r�r_�value�section�test_setup_cfg_contents�f�foobar_pathrrr�create_setup_requires_packagesT�



�����r�cCsdtd�td�td�ddd�ddid	�}|�gd
��|d}|��tjj||d�|�d
d�|S)Nz�
            [build-system]
            requires = ["setuptools"]
            build-backend = "setuptools.build_meta"
            z�
            __import__('setuptools').setup(
                pbr=True,
                setup_requires=["pbr"],
            )
            z
            [metadata]
            name = mypkg

            [files]
            packages =
                mypkg
            rzprint('Hello world!'))r�zhello.pyztest.txtzAnother file in here.)zpyproject.tomlrvrx�mypkg�other)�pythonr5�pip�install�pbrr�)�prefix�PBR_VERSIONz0.42)r�runr��jaracor"r6�setenv)r0rrNror�rrr�pbr_packageas(����� r�)&rrdrEr*r!rbrk�pathlibr�jaraco.pathr�r"r.�setuptools._normalizationrrrr�textwrapr�fixturerrr%r2r3rBrJrMrNrWr]rur{r�r�r�r�rrrr�<module>s`







	
	

	
	$
�M