CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
fixtures.cpython-310.pyc141 linesDownload Raw Back to __pycache__
1o

2��Yi�-�@stddlZddlZddlZddlZddlZddlZddlZddlmZddl	Z3ddlZddlZddl
mZddlmZmZddlmZejdd��Zejd	d4��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)�5safer_name�)�contexts�environment)�DALSc6cs��t���H}|�d|�t���%}|�d|�t���dVWd�n1s)wYWd�n1s8wYWd�dSWd�dS1sPwYdS)za7    Override site.USER_BASE and site.USER_SITE with temporary directories in8    a context.9    zsite.USER_BASEzsite.USER_SITEN)r�tempdir�setattrZsave_user_site_setting)�monkeypatch�	user_base�	user_site�r
��E:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\setuptools/tests/fixtures.py�
user_overrides�101112����"�rccs6�|���}|VWd�dS1swYdS�N)Zas_cwd)�tmpdir�origr
r
r�13tmpdir_cwd"s�14"�rT�session)Zautouse�scopecCsN|jj�d�s	dSt�t��tj�d�Wd�dS1s wYdS)z�15    Workaround pytest-dev/pytest-xdist#37616 17    ``pytest-xdist`` tends to inject '' into ``sys.path``,18    which may break certain isolation expectations.19    Remove the entry so the import20    machinery behaves the same irrespective of xdist.21    ZxdistN�)	�configZ
pluginmanagerZ22has_plugin�23contextlib�suppress�24ValueError�sys�path�remove)�requestr
r
r�workaround_xdist_376(s2526"�rcCsHgd�}ztj|t|�d�W|dSty#t�d�Y|dSw)z<27    Clone the 'sampleproject' and return a path to it.28    )�git�clonez%https://github.com/pypa/sampleproject)�cwdzUnable to clone sampleprojectZ
sampleproject)�29subprocess�30check_call�str�	Exception�pytest�skip)�tmp_path�cmdr
r
r�sample_project9s��r+ccs8�t�|��dVWd�dS1swYdSr)rr)r+r
r
r�sample_project_cwdFs�"�r,c31Cs�t�||d��]}t|�d�d�}t|�d�d�}|r'|r'||fWd�St|jjd���r2J�t�	t32jdddt|�t|jj�g�t|jjd���rOJ�t|�d��t|�d��fWd�S1sgwYdS)NZ33dist_buildz*.tar.gzz*.whlzbuild/lib/build�-m�buildz--outdir)
rZsession_locked_tmp_dir�next�globrr�rootdir�existsr#�check_outputr�34executabler%)�tmp_path_factoryr�tmp�sdist�wheelr
r
r�_build_distributionsTs*��	35�36$�r9)rcCs8t�d�}|rtj�|�rt|���St||�\}}|S)NZPRE_BUILT_SETUPTOOLS_SDIST��os�getenvrr2r�resolver9)r5r�prebuiltr7�_r
r
r�setuptools_sdisto�3738r@cCs8t�d�}|rtj�|�rt|���St||�\}}|S)NZPRE_BUILT_SETUPTOOLS_WHEELr:)r5rr>r?r8r
r
r�setuptools_wheelyrArBcCsdt��}t�|d�|_ddg|_t|�|_tjdd��|�	�Wd�S1s+wYdS)z?Virtual env with the version of setuptools under test installed�venv�--no-setuptoolsz--wheel=bundleN)�39PYTHONPATH)40r�41VirtualEnvrr�root�create_optsr%�reqr�create)r)rB�envr
r
rrC�s4243$�rCcCs.t��}t�|d�|_ddg|_|��|S)z7Virtual env without any version of setuptools installed�venv_without_setuptoolsrD�44--no-wheel�rrFrrrGrHZ45ensure_env�r)rKr
r
rrL��4647rLcCs.t��}t�|d�|_gd�|_|��|S)z1Virtual env without any common packages installed�	bare_venv)rDz--no-piprMz	--no-seedrNrOr
r
rrQ�rPrQcCs�t|�dksJ�t�|d��3}|D]'\}}t�|�d��}tj|d�}t|���|_t	t4849��|_|j||d�qWd�dS1sDwYdS)z�50    Create a simple sdist tarball at dist_path, containing the files51    listed in ``files`` as ``(filename, content)`` tuples.52    rzw:gz�utf-8)�name)�fileobjN)
�len�tarfile�open�io�BytesIO�encode�TarInfo�getvalue�size�int�time�mtime�addfile)�	dist_path�files�dist�filename�contentZ53file_bytes�	file_infor
r
r�54make_sdist�s�"�rhc	Cs(t|dtd|�d|�d��fdg�dS)z\55    Create a simple sdist tarball at dist_path, containing just a simple56    setup.py.57    �setup.pyzT             import setuptools58             setuptools.setup(59                 name=z,60                 version=z61             )62         ��	setup.cfgrN)rhr)rb�distname�versionr
r
r�make_trivial_sdist�s������rnc6364s�d|vsJ�|�d���d}�fdd�tdt��d�D�}td|�d|�d|�d	|�d65�	�}d}d|ftj�|d
�|fg}|dd�D]}tjj|�d�d
g�}	|�|	df�qEt||�dS)z�66    Make an sdist tarball with distname and version which also contains one67    package with the same name as distname.  The top-level package is68    designated a namespace package).69    �.rcsg|]}d��d|���qS)roN)�join)�.0�idx��partsr
r�70<listcomp>�sz$make_nspkg_sdist.<locals>.<listcomp>rzE        import setuptools71        setuptools.setup(72            name=z,73            version=z,74            packages=z",75            namespace_packages=[z]76        )77    z7__import__('pkg_resources').declare_namespace(__name__)ri�__init__.pyNr)	�split�rangerUrr;rrp�appendrh)78rbrlrmZ	nspackage�packages�setup_py�initrc�packagerer
rsr�make_nspkg_sdist�s*79 �����r~cCs&t|dtd�j|||d�fdg�dS)Nriz�                import setuptools80                setuptools.setup(81                  name={name!r},82                  version={version!r},83                  python_requires={python_requires!r},84                )85                )rSrm�python_requiresrj)rhr�format)rbrlrmrr
r
r�make_python_requires_sdist�s�	����r�Zfoobarz0.1r
cCs�t|�}dd|�d|��gtj�|�gd�}|r|�|�tj�|d�}	t�|	�|rjg}86g}|D](}|�|�}
|d��vrA|}n|87}t	|
t88tf�rOd�|
�}
|�|�d|
���q1t
d�jd	�|89�d	�|�d90�}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 a91    single requirement in setup_requires--a tarball for that requirement is92    also created and added to the dependency_links argument.93 94    ``distname`` and ``version`` refer to the name/version of the package that95    the test package requires via ``setup_requires``.  The name of the test96    package itself is just 'test_pkg'.97    �test_pkgz0.0z==)rSrmZsetup_requiresZdependency_linkszname version�;z: zg98            [metadata]99            {metadata}100            [options]101            {options}102            �103)�options�metadatarrk�wrR)�encodingNzI            import setuptools104            setuptools.setup(**%r)105        ri�-z.tar.gz)rr;r�abspath�updaterp�mkdir�poprw�106isinstance�tuple�listryrr�rW�write)rrlrmZmake_packageZsetup_py_templateZsetup_attrsZ
use_setup_cfgZnormalized_distnameZtest_setup_attrsr�r�r�rS�value�sectionZtest_setup_cfg_contents�fZfoobar_pathr
r
r�create_setup_requires_packagesT�107108109110�����r�cCsdtd�td�td�ddd�ddid	�}|�gd111��|d}|��tjj||d�|�d
d�|S)Nz�112            [build-system]113            requires = ["setuptools"]114            build-backend = "setuptools.build_meta"115            z�116            __import__('setuptools').setup(117                pbr=True,118                setup_requires=["pbr"],119            )120            z121            [metadata]122            name = mypkg123 124            [files]125            packages =126                mypkg127            rzprint('Hello world!'))rvzhello.pyztest.txtzAnother file in here.)zpyproject.tomlrirk�mypkg�other)�pythonr-�pip�installZpbrr�)�prefixZPBR_VERSIONz0.42)r�runr��jaracorr.Zsetenv)r)r128rCrcr�r
r
r�pbr_packageas(����� r�)&rrXr;r#rrVr_�pathlibrZjaraco.pathr�rr'Zsetuptools._normalizationrrrr�textwraprZfixturerrrr+r,r9r@rBrCrLrQrhrnr~r�r�r�r
r
r
r�<module>s`129
130131132133
134135136	137	138139	140	$141�M