\bgdZddlZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZmZdZd Zejd Zejd ZGd d ZGddZGddZdS)z develop testsN)paths_on_pythonpath)develop) Distribution)contexts namespaceszHfrom setuptools import setup setup(name='foo', packages=['foo'], ) z print "foo" c#Ktj5}tj5}|d||d|dVdddn #1swxYwYddddS#1swxYwYdS)Nzsite.USER_BASEzsite.USER_SITE)rtempdirsetattr) monkeypatch user_base user_sites n/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/tests/test_develop.py temp_userrs    y     9    0) < < <    0) < < < EEE               s4A?1A' A?'A+ +A?.A+ /A??BBc#*K|}|d}|dz }|rtt||d5}|t dddn #1swxYwY|dz }|d5}|tdddn #1swxYwY|5|VddddS#1swxYwYdS)Nfoosetup.pywz __init__.py) mkdirisfile ValueErrordiropenwriteSETUP_PYINIT_PYas_cwd)tmpdirrtargetrsetupfinits rtest_envr#&s F ,,u  C Z E ||~~&V%%% CA   D 31   s6$B  BB0CCC6DD D ceZdZeedZeedoejejkZdZ e j ddZ dS) TestDevelop real_prefix base_prefixctjdtddgdddgi}t|}d|_t |}|||_|dS) z Test that console scripts are installed and that they reference only the project by name and not the current version. zTTODO: needs a fixture to cause 'develop' to be invoked without mutating environment.rz0.0console_scriptszfoocmd = foo:foo)namepackagesversion entry_pointsrN) pytestskipdictr script_namerensure_finalized install_dirrun)selfrsettingsdistcmds rtest_console_scriptsz TestDevelop.test_console_scripts:s   :   W!&$    H%%%dmm    z0legacy behavior retained for compatibility #4167reasonctd}t|}t|}|t j|j}|jdksJ|jdksJdS)NzFoo $$$ Bar_baz-bing)r*z .egg-linkFoo_Bar_baz_bing) r0rrr2pathlibPathegg_linksuffixstem)r5r6r7r8links rtest_egg_link_filenamez"TestDevelop.test_egg_link_filenameUs'   H%%dmm |CL)){k))))y.......r:N)__name__ __module__ __qualname__hasattrsys in_virtualenvr'prefixin_venvr9r.markxfailrEr:rr%r%6sGC//Mgc=))Kco.KG6 [PQQ / /RQ / / /r:r%c$eZdZdZdZdZdZdS) TestResolverz TODO: These tests were written with a minimal understanding of what _resolve_setup_path is intending to do. Come up with more meaningful cases that look like real-world scenarios. c>tjddddksJdS)N.r_resolve_setup_pathr5s rtest_resolve_setup_path_cwdz(TestResolver.test_resolve_setup_path_cwdis(*3S99S@@@@@@r:c>tjddddksJdS)NpkgsrT../rUrWs rtest_resolve_setup_path_one_dirz,TestResolver.test_resolve_setup_path_one_dirls(*63??5HHHHHHr:c>tjddddksJdS)Nzpkgs/rTrZr[rUrWs r.test_resolve_setup_path_one_dir_trailing_slashz;TestResolver.test_resolve_setup_path_one_dir_trailing_slashos(*7C@@EIIIIIIr:N)rFrGrH__doc__rXr\r^rPr:rrRrRbsV AAAIIIJJJJJr:rRceZdZedZejee j ddeje j dkddZdS) TestNamespacesc.tjdddt|g}|5t t|g5t j|dddn #1swxYwYddddS#1swxYwYdS)Nrrz --install-dir)rJ executablestrrr subprocess check_call)src_dirr develop_cmds rinstall_developzTestNamespaces.install_developts N    KK  ^^   3 3$c&kk]33 3 3%k222 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3s5B A2& B 2A6 6B 9A6 :B  BBAPPVEYORz-https://github.com/pypa/setuptools/issues/851r;PyPyz.https://github.com/pypa/setuptools/issues/1202c tj|d}tj|d}|dz }tjdddt |dt |g}t j||||tj|tjdd g}tt |g5t j|d d d n #1swxYwYtjdd g}tt |g5t j|d d d d S#1swxYwYd 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.pkgBr+z-mpipinstallz-tz-cz"import myns.pkgA; import myns.pkgBNzimport pkg_resources) rbuild_namespace_packagerJrcrdrerfri make_site_dirr)r5rpkg_Apkg_Br install_cmd try_importpkg_resources_imps r!test_namespace_package_importablez0TestNamespaces.test_namespace_package_importables26;GG26;GG*$ N    JJ  KK  k*** UF+++ ((( N  0 !#f++ / / . .  !* - - - . . . . . . . . . . . . . . . N  "  !#f++ / / 5 5  !"3 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s$C((C,/C,EEEN)rFrGrH staticmethodrir.rNskipifboolosenvirongetplatformpython_implementationrvrPr:rrarass 3 3\ 3 [ RZ^^J ' '((> [&&((F2?&5&5  &5&5&5r:ra)r_rzr?r}rerJr.setuptools._pathrsetuptools.command.developrsetuptools.distrrrrrfixturerr#r%rRrarPr:rrse  000000......((((((""""""""     )/)/)/)/)/)/)/)/XJJJJJJJJ"<5<5<5<5<5<5<5<5<5<5r: