\bgHddlZddlZddlmZddlmZGddZdS)N)paths_on_pythonpath) namespacesc&eZdZdZdZdZdZdS)TestNamespacesc ^tj|d}tj|d}|dz }|dz }||f}tjdddt |dt |g}t j|tj|tjdddt |dt |g}t j|tjd d g}ttt|5t j|d d d d S#1swxYwYd S) z Installing two packages sharing the same namespace, one installed to a site dir and the other installed just to a path on PYTHONPATH should leave the namespace in tact and both packages reachable by import. myns.pkgA myns.pkgBz site-packagesz path-packages-m pip.__main__install-t-cz"import myns.pkgA; import myns.pkgBN) rbuild_namespace_packagesys executablestr subprocess check_call make_site_dirrmap) selftmpdirpkg_Apkg_B site_packages path_packagestargets install_cmd try_imports q/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/tests/test_namespaces.pytest_mixed_site_and_non_sitez+TestNamespaces.test_mixed_site_and_non_site sx26;GG26;GG0 0 . N    JJ      k*** /// N    JJ      k*** N  0 !S'!2!2 3 3 . .  !* - - - . . . . . . . . . . . . . . . . . .sD""D&)D&c (tj|d}|dz }|tjddddt |t |g}t t |g5tj|dddn #1swxYwYtj |tjdd g}t t |g5tj|ddddS#1swxYwYdS) zc Ensure that a namespace package doesn't break on import of pkg_resources. r packagesr pipr rNrzimport pkg_resources) rrmkdirrrrrrrr)rrpkgtargetrr s r!test_pkg_resources_importz(TestNamespaces.test_pkg_resources_import4s 0EE*$  N     KK HH !#f++ / / / /  !+ . . . / / / / / / / / / / / / / / / ((( N  " !#f++ / / . .  !* - - - . . . . . . . . . . . . . . . . . .s$9BB!B%DD D c tj|d}|dz }tjdddt |dt |g}t j|tj|tjddg}tt |g5t j|t | d d d d S#1swxYwYd S) z Installing a namespace packages but also having it in the current working directory, only one version should take precedence. r r$r r r rrz&import pkg_resources; import myns.pkgAcwdN rrrrrrrrr)rrrr(rpkg_resources_imps r!(test_namespace_package_installed_and_cwdz7TestNamespaces.test_namespace_package_installed_and_cwdPs2 26;GG*$ N    JJ  KK  k*** ((( N  4  !#f++ / / E E  !"3U D D D D E E E E E E E E E E E E E E E E E Es$C  CCc tj|d}tj|d}|dz }tjdddt |dt |g}t j|tj|tjdd g}tt |g5t j|t | d d d d S#1swxYwYd S) z Installing one namespace package and also have another in the same namespace in the current working directory, both of them must be importable. r r r$r r r rrz8import pkg_resources; import myns.pkgA; import myns.pkgBr+Nr-)rrrrr(rr.s r!5test_packages_in_the_same_namespace_installed_and_cwdzDTestNamespaces.test_packages_in_the_same_namespace_installed_and_cwdmsD 26;GG26;GG*$ N    JJ  KK  k*** ((( N  F  !#f++ / / E E  !"3U D D D D E E E E E E E E E E E E E E E E E Es1$C""C&)C&N)__name__ __module__ __qualname__r"r)r/r1r!rr sY(.(.(.T...8EEE:EEEEEr6r)rrsetuptools._pathrrrr5r6r!r9s 000000AEAEAEAEAEAEAEAEAEAEr6