o
    5‘ði@  ã                   @   s~   d Z ddlZddlZddlZddlZddlZddlmZ ddlm	Z	m
Z
 dZdZejdd	„ ƒZejd
d„ ƒZG dd„ dƒZdS )zdevelop testsé    N)Úpaths_on_pythonpathé   )ÚcontextsÚ
namespaceszHfrom setuptools import setup

setup(name='foo',
    packages=['foo'],
)
zprint "foo"
c              	   c   s†   � t  ¡ �4}t  ¡ �}|  d|¡ |  d|¡ d V  W d   ƒ n1 s$w   Y  W d   ƒ d S W d   ƒ d S 1 s<w   Y  d S )Nzsite.USER_BASEzsite.USER_SITE)r   ÚtempdirÚsetattr)ÚmonkeypatchÚ	user_baseÚ	user_site© r   ú\/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/tests/test_develop.pyÚ	temp_user   s   €

ýÿ"ÿr   c                 c   sÐ   � | }|  d¡}|d }| ¡ rtt|ƒƒ‚| d¡�}| t¡ W d   ƒ n1 s+w   Y  |d }| d¡�}| t¡ W d   ƒ n1 sIw   Y  | ¡ � |V  W d   ƒ d S 1 saw   Y  d S )NÚfooúsetup.pyÚwz__init__.py)	ÚmkdirÚisfileÚ
ValueErrorÚdirÚopenÚwriteÚSETUP_PYÚINIT_PYÚas_cwd)Útmpdirr   Útargetr   ÚsetupÚfÚinitr   r   r   Útest_env#   s    €
ÿÿ
"ÿr   c                   @   sj   e Zd Zedd„ ƒZejjdd�ejje	e
j d¡ƒdd�ejje ¡ dkdd�ejjd	d
„ ƒƒƒƒZdS )ÚTestNamespacesc              	   C   sŠ   t jdddt|ƒg}|  ¡ �- tt|ƒgƒ� t |¡ W d   ƒ n1 s&w   Y  W d   ƒ d S W d   ƒ d S 1 s>w   Y  d S )Nr   Údevelopz--install-dir)ÚsysÚ
executableÚstrr   r   Ú
subprocessÚ
check_call)Úsrc_dirr   Údevelop_cmdr   r   r   Úinstall_develop4   s   û
ÿÿ"ÿzTestNamespaces.install_developzpkg_resources has been removed)ÚreasonÚAPPVEYORz-https://github.com/pypa/setuptools/issues/851ÚPyPyz.https://github.com/pypa/setuptools/issues/1202c                 C   sê   t  |d¡}t  |d¡}|d }tjdddt|ƒdt|ƒg}t |¡ |  ||¡ t  |¡ tjdd	g}t	t|ƒgƒ� t |¡ W d
  ƒ n1 sKw   Y  tjddg}t	t|ƒgƒ� t |¡ W d
  ƒ d
S 1 snw   Y  d
S )a  
        Installing two packages sharing the same namespace, one installed
        naturally using pip or `--single-version-externally-managed`
        and the other installed using `develop` should leave the namespace
        in tact and both packages reachable by import.
        z	myns.pkgAz	myns.pkgBÚpackagesz-mÚpipÚinstallz-tz-cz"import myns.pkgA; import myns.pkgBNzimport pkg_resources)
r   Úbuild_namespace_packager"   r#   r$   r%   r&   r)   Úmake_site_dirr   )Úselfr   Úpkg_AÚpkg_Br   Úinstall_cmdÚ
try_importÚpkg_resources_impr   r   r   Ú!test_namespace_package_importableA   s8   ù
	
ýÿý"ÿz0TestNamespaces.test_namespace_package_importableN)Ú__name__Ú
__module__Ú__qualname__Ústaticmethodr)   ÚpytestÚmarkÚxfailÚskipifÚboolÚosÚenvironÚgetÚplatformÚpython_implementationÚuses_networkr8   r   r   r   r   r    3   s    
þ
þr    )Ú__doc__rB   rE   r%   r"   r=   Úsetuptools._pathr   Ú r   r   r   r   Úfixturer   r   r    r   r   r   r   Ú<module>   s    

