K i{ ddlmZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl mZddlmZddlmZdd lmZdd lmZddlZddlZddlZddlmZdd lmZdd l m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(dd l)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0m1Z1ddl2m3Z3ejhddgdZ5ededjmdddededddd id!Z7d"Z8ejrjuejd#k(d$%ejrjwd&ie7d'e8ie7gd(ZGd+d,Z?Gd-d.Z@d/ZAGd0d1ZBd2ZCGd3d4ZDGd5d6ZEejrjd7d8ZGejrjd9ZIGd:d;ZJGd<d=ZKGd>d?ZLd@ZMejrjdAdBZNdCZOdDZPdEZQdHdFZRdIdGZSy)J) annotationsN)deepcopy) import_module)EXTENSION_SUFFIXES)Path)dedent)Any)Mock)uuid4) resources) _encode_pth_find_namespaces_find_package_roots_find_virtual_namespaces_finder_template _LinkTree_TopLevelFindereditable_wheel) Distribution) Extension)SetuptoolsDeprecationWarning)contexts namespaces) run_setupstrictlenient)paramsc,|jdk(rddgSgS)Nr--config-settingseditable-mode=strict)param)requests l/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/setuptools/tests/test_editable_install.py editable_optsr%*s}} #%;<< Ia [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name = "mypkg" version = "3.14159" license = {text = "MIT"} description = "This is a Python package" dynamic = ["readme"] classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers" ] urls = {Homepage = "https://github.com"} [tool.setuptools] package-dir = {"" = "src"} packages = {find = {where = ["src"]}} license-files = ["LICENSE*"] [tool.setuptools.dynamic] readme = {file = "README.rst"} [tool.distutils.egg_info] tag-build = ".post0" zr global-include *.py *.txt global-exclude *.py[cod] prune dist prune build zThis is a ``README``z!---- placeholder MIT license ----mypkga import sys from importlib.metadata import PackageNotFoundError, version try: __version__ = version(__name__) except PackageNotFoundError: __version__ = "unknown" a  from importlib.resources import read_text from . import __version__, __name__ as parent from .mod import x data = read_text(parent, "data.txt") print(__version__, data, x) zx = ''z Hello World) __init__.pyz __main__.pymod.pyzdata.txt)pyproject.toml MANIFEST.inz README.rstz LICENSE.txtsrcz __import__('setuptools').setup()darwinpypa/setuptools#4328reasonfilessetup.pyc |dz }|jtjj||ddddddt |g|}t |j |gd }|j |jd k(sJ|d z jd d |dz jdd |j |jdk(sJy)Nr'prefixpython-mpipinstall--no-build-isolation-e)r6r7r'z3.14159.post0 Hello Worldzsrc/mypkg/data.txtfoobarutf-8encodingzsrc/mypkg/mod.pyx = 42z3.14159.post0 foobar 42) mkdirjaracopathbuildstrprintrunstrip write_text)tmp_pathvenvr1r%projectcmds r$test_editable_with_pyprojectrN{s G MMO KKeG,     G    C $((3- #C 88C=   $? ?? ? ##//7/K !!--h-I 88C=   $= == =r&c "dtdddiddi}tjj|||dz }dd d d d d t |g|}t |j |gd}|j |jdk(sJy)Nr'ac [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [project] name = "mypkg" version = "3.14159" [tool.setuptools] packages = ["pkg"] py-modules = ["mod"] r(za = 4b = 2)r*pkgr)r4r6r7r8r9r:r;)r6-cz$import pkg, mod; print(pkg.a, mod.b)z4 2rrBrCrDrErFrGrHrJrKr%r1rLrMs r$test_editable_with_flat_layoutrUs$ "7+#  E* KKeH- G     G    C $((3- BC 88C=   E )) )r&c dtdddi}tjj|||dz }dddd d d t |g|}t |j |gd }|j |jd k(sJy)Nr'a> [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [project] name = "mod" version = "3.14159" [tool.setuptools] py-modules = ["mod"] rP)r*r)r4r6r7r8r9r:r;)r6rRzimport mod; print(mod.b)2rSrTs r$ test_editable_with_single_modulerXs$    E& KKeH- G     G    C $((3- 6C 88C=   C '' 'r&ceZdZdZej j ddej j dddZy)TestLegacyNamespacescPtjtd}|dz }|jd}|D]}t j ||d}|5|j 5}|j|tdd } t| } | j| jd j} | j|| ddddddt|jd } t!| t!|k(sJy#1swYGxYw#1swYxYw) Nz .*namespace_packages parameter.*matchz.installation_dir)z myns.pkgAz myns.pkgB myns.n.pkgA myns.n.pkgB42)versionr2config) stop_after dist_infoz *-nspkg.pth)pytestwarnsrrArbuild_namespace_packagecontextchdirrrfinalize_optionsget_finalized_commandname_install_namespaceslistgloblen) selfrJ monkeypatch deprecationinstallation_direxamplesrlrQctxdistrM editable_namer1s r$test_nspkg_file_is_uniquez.TestLegacyNamespaces.test_nspkg_file_is_uniques(ll (0R $&99   ID44XtTRC Ik113 Is # A$T*$$& # 9 9+ F K K ''(8-H  I I I I%**=9:5zS]*** I I I Is%D#A'D DD DD% impl) pkg_resourcesns)zmyns.nc d}tj||d|}tj||d|}|dz j|d|dz j|d|dd} | jd |j d d d d t |g| |j d d d d dt |g| |j d dd|d|dg|j gdy)a> Installing two packages sharing the same namespace, one installed naturally using pip or `--single-version-externally-managed` and the other installed in editable mode should leave the namespace intact and both packages reachable by import. (Ported from test_develop). zq [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" z.pkgA)rzz.pkgBr*r=r>Nr:r6r7r8r9r;rRzimport z.pkgA; import )r6rRzimport pkg_resources)rrgrIappendrGrE) rqrKrJr|rzr% build_systempkg_Apkg_Boptss r$!test_namespace_package_importablez6TestLegacyNamespaces.test_namespace_package_importables$ 228t5\PTU228t5\PTU ! !--lW-M ! !--lW-MQ *+ (D%CJFFG (D%D#e*LtLM (DGB4~bT"GHI 9:r&N)__name__ __module__ __qualname__ryremark parametrizerr&r$rZrZsM+4 [[  [[T;/;0;r&rZceZdZdZdZdZy)TestPep420Namespacesc 4tj|d}tj|d}|dd}|jd|jddddt |g||jddddd t |g||jgd y) z Installing two packages sharing the same namespace, one installed normally using pip and the other installed in editable mode should allow importing both packages. r^r_Nr:r6r7r8r9r;)r6rRz&import myns.n.pkgA; import myns.n.pkgB)rbuild_pep420_namespace_packager~rGrE)rqrKrJr%rrrs r$rz6TestPep420Namespaces.test_namespace_package_importable-s 99(MR99(MRQ *+ (D%CJFFG (D%D#e*LtLM KLr&c dtdddidi}tjj|||dz }t j |d}t j |d}|d d }|j d |jd d d dt|g||jd d d ddt|g||jd d d ddt|g||jgdy )z@Currently users can create a namespace by tweaking `package_dir`pkgAat [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [project] name = "pkgA" version = "3.14159" [tool.setuptools] package-dir = {"myns.n.pkgA" = "src"} r(a = 1)r*r,r4r_z myns.n.pkgCNr:r6r7r8r9r;)r6rRz#from myns.n import pkgA, pkgB, pkgC) rrBrCrDrrr~rGrE) rqrKrJr%r1rrpkg_Crs r$&test_namespace_created_via_package_dirz;TestPep420Namespaces.test_namespace_created_via_package_dir<s "(  #&w/ &  %16!99(MR99(MRQ *+ (D%CJFFG (D%D#e*LtLM (D%D#e*LtLM HIr&c tdtdddddddtdd i}tjj || |dz }d g}|j d d ddddt |g||j gd}|jdk(sJd}|j d dt|g}d|vsJy)a/Sometimes users might specify an ``include`` pattern that ignores parent packages. In a normal installation this would ignore all modules inside the parent packages, and make them namespaces (reported in issue #3504), so the editable mode should preserve this behaviour. rar [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [project] name = "pkgA" version = "3.14159" [tool.setuptools] packages.find.include = ["mypkg.*"] zb = 1r)r(zpkgA.py)r(zother.pynr+)r*r'r+r4r:r6r7r8-vr9r;)r6rRz'from mypkg.n import pkgA; print(pkgA.a)1z} try: import mypkg.other except ImportError: print("mypkg.other not defined") rRzmypkg.other not definedN)rEXAMPLErBrCrDrGrErH)rqrKrJr1rroutrMs r$0test_namespace_accidental_config_in_lenient_modezETestPep420Namespaces.test_namespace_accidental_config_in_lenient_mode^s "(  #$& '')#* '}5/ 6  %16!'' (D%y$E RTRShhRSyy{c!!!  hh$s 45(C///r&N)rrrrrrrr&r$rr,s M JD00r&rc |dz }tjDcgc]P}d|vrJ|jtjr+|t |j tjz R}}|D]}|j dt|ttjtjjtt|}tjdddd t|d t|d g |}t!j"|| t%j&d k(rdnd} || z dz } t!j"| g| ycc}w)z> Editable install to a prefix should be discoverable. r5z site-packagesT)parents) PYTHONPATHr7r8r9 --editablez--prefixr:)envWindowsScriptsbinsampleN)sysrC startswithr5r relative_torA _addsitedirsdictosenvironpathsepjoinmaprE executable subprocess check_callplatformsystem) rJsample_projectr%r5rCsite_packages_allsprrMrexes r$test_editable_with_prefixrs7 F HH  d "tszz'B d'' 33   "# rzzbjjooc#?P6Q&R SC    N F    C#3' (I5)5C 3, !C3%S)=sAEcReZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zy )TestFinderTemplateThis test focus in getting a particular implementation detail right. If at some point in time the implementation is changed for something different, this test can be modified or even excluded. c6i}t||||dy)Nr9)exec)rqfinderlocs r$install_finderz!TestFinderTemplate.install_finders VS#Ir&cddddididdid}tjj|| t|d z t|d z d }t tt |i}t j5t j5d D]"}tjj|d$|j|td}td}td}|jdk(sJ|jdk(sJt|dz j} t!|| ddddddy#1swYxYw#1swYyxYw)Npkg1rmod1.pyza = 42)r(subpkgmod2.pyza = 43src1src2r4z src1/pkg1z src2/mod2)rmod2)r pkg1.subpkgpkg1.subpkg.mod1rrrr*+zsrc1/pkg1/subpkg)rBrCrDrErr r save_pathssave_sys_modulesrmodulespoprraresolve assert_path) rqrJr1mappingtemplatemodmod1rrexpecteds r$ test_packagesz TestFinderTemplate.test_packagessS#%((3 )   %1;./;./ $CL'2>  " *H$=$=$? *J + T* +    ) !34D (D"=1F66R< <66R< <H'99BBDEH  ) * * * * * *s%?EB$E 8E E EEcddddi}tjj||dt|dz i}dgi}t tt ||}t j5t j5dD]"}tjj|d$|j|td}tj|d z }t|dz j!} t#|| |j$d k(sJ|j'd dk(sJ ddddddy#1swYxYw#1swYyxYw) NrQa = 13abc)r(text.txtr4 ns.othernamer|r|rr r=r>)rBrCrDrErr rrrrrrrrimportlib_resourcesr1rrr read_text) rqrJr1rrrrrQtextrs r$test_namespacez!TestFinderTemplate.test_namespaces7eDE %1!3x%'7#89BZ #CL':F  " =H$=$=$? =- + T* +    )/C&,,S1J>DHu,5578H X &55B; ;>>7>3u< << = = = = = =s%/EB,E1EE EEcddddiiidddiid}tjj||t|d z t|d z d }dt|d z t|d z gi}t tt ||}t j5t j5dD]"}tjj|d$|j|td}td}t|d z j} t|| |j dk(sJ|j"dk(sJ ddddddy#1swYxYw#1swYyxYw)Nr|rr(rrb = 37rr4z src1/ns/pkg1zsrc2/ns)ns.pkgAr|rr)r|rns.mod2rrr%)rBrCrDrErr rrrrrrrrrrrb) rqrJr1r namespaces_rrrrrs r$test_combine_namespacesz*TestFinderTemplate.test_combine_namespacesseF]H$=>?Ix01   %18n45h*+ c(V"34c(V:K6LMN #CL';G  " H$=$=$? 3 + T* +    ) +D +DH~5>>@AH h '66R< <66R< < s%E*3BE E*E' #E**E3cLdddiidddiid}tjj}|j|5tjj |dd d d d d gd}t |}t |tt}td|jD}dddtj5tj5dD]"}tjj!|d$|j#t%d} t%d} t|dz j'} tt)| j*j'| k(sJt|dz j'} tt)| j*j'| k(sJ| j,dk(sJ| j.dk(sJ ddddddy#1swYSxYw#1swYxYw#1swYyxYw)z Users may attempt to combine namespace packages in a nested way via ``package_dir`` as shown in pypa/setuptools#4248. my_packagez my_module.pyr my_package2z my_module2.pyr)r,r %PEP 517%zsrc/my_packagezsrc2/my_package2)different_namedifferent_name.subpkgrr) script_name package_dirpackagesc3JK|]\}}|jds|yw)z.pyNendswith).0kvs r$ zDTestFinderTemplate.test_combine_namespaces_nested...s WdaQZZPUEVWs##Nrzdifferent_name.my_modulez different_name.subpkg.my_module2zsrc/my_package/my_module.pyzsrc2/my_package2/my_module2.pyrr)rBrCDirectoryStackrhrDrrrEr nextget_implementationrrrrrrrrrr__file__rr) rqrJr1stackattrsrwrcoderrrrs r$test_combine_namespaces_nestedz1TestFinderTemplate.test_combine_namespaces_nesteds!>8"<="_h$?@   **, ]]8 $ X KK  e $*&6-? ./FG E &D$T3uw<8FWf&?&?&AWWD X " H$=$=$? Z( + T* +    % !;.MsK4-v&Ks)onetwothreez parent.childzparent.child.onerzparent.child.twor zparent.child.threer )rBrCrDrErr rrrrrrrrxreraises ImportErrorr~) rqrJr1rrrmodsrrrrs r$test_dynamic_path_computationz0TestFinderTemplate.test_dynamic_path_computationAs"Gh-@#AB!Gh-@#AB!Gj'-B#CD   %1#h1B&B"C!DE #CL';GK3JK  " H$=$=$?  ..H4H + T* +    ) 23C55A: :{+ 201 2 HHOOC: 56 7 23C55A: :{+ 423 4 HHOOC: 56 7!"67E77a< <+    2 2 4 4!    sWHA4H  G2A(H  G>AH !H2G; 7H >H H  H HHc*dddii}tjj||dt|dz i}t tt |i}t j5t j5tjjdd|j|tjtd5t!ddddddddddy#1swYxYw#1swYxYw#1swYyxYw)NrQr(zfrom . import pkgr4r\rBrCrDrErr rrrrrrrrerrrrqrJr1rrs r$test_no_recursionz$TestFinderTemplate.test_no_recursiones 2   %1 3x%'( $CL'2>  " %H$=$=$? % KKOOE4 (    ){%8 %e$ %  % % % % %  % % % %s=*D ?A C= C1C= D 1C: 6C==D D  Dcpddddidi}tjj||dt|dz i}t tt |i}t j5t j5tjjddtjjdd|j|tjtd5t!ddddddddddy#1swYxYw#1swYxYw#1swYyxYw) Nfoorr()r(barr4zfoo.barr<r\rrs r$test_similar_namez$TestFinderTemplate.test_similar_namezs !!2   %1 3x%'( $CL'2>  " (H$=$=$? ( KKOOE4 ( KKOOIt ,    ){(; (h' (  ( ( (  ( (  ( ( ( (s=-D,A-D / D;D D,D D  D) %D,,D5cdddddddi}tjj||dt|dz i}t tt |i}t j5t j5tjjdd|j|tjtd 5t!d dddtjtd 5t!d dddtjtd 5t!ddddtjtd 5t!ddddtjtd 5t!ddddt!d}|j"dk(sJt!d}|j"dk(sJ ddddddy#1swYxYw#1swYxYw#1swYxYw#1swYxYw#1swYxYw#1swYOxYw#1swYyxYw)Nrrrr )r( lowercase.py)r(r!rr4z'FOO'r\FOOz'foo\.LOWERCASE'z foo.LOWERCASEz'foo\.bar\.Lowercase'zfoo.bar.Lowercasez 'foo\.BAR'zfoo.BAR.lowercasezFOO.bar.lowercasez foo.lowercaserzfoo.bar.lowercaser)rBrCrDrErr rrrrrrrrerrrr)rqrJr1rrrs r$test_case_sensitivityz(TestFinderTemplate.test_case_sensitivitys ! '#%$+    %1 3x%'( $CL'2>  " H$=$=$?  KKOOE4 (    ){': %e$ %{2EF /o. /{2KL 312 3{-@ 312 3{': 312 3 0C55A: : 34C55A: :/    % % / / 3 3 3 3 3 3!    s/H4A H( G+#H( G8 #H(/ H;#H( H*#H( HAH(H4+G5 0H(8H =H(H H(H H(H% !H((H1 -H44H=c,ddddddi}tjj||dt|dz i}d gi}t tt ||}t j5t j5d D]"}tjj|d$|j|td}t|dz j}t|||j d k(sJtd } | j"d k(sJtd} | j$dk(sJt'j(t*d5tddddt'j(t*d5tddddt'j(t*d5tddddddddddy#1swYxxYw#1swYUxYw#1swY2xYw#1swY6xYw#1swYyxYw)NrQrrzc = 42)r(zbar.py)r(rr4rr|rrzns.othername.foorzns.othername.foo.barrz'NS'r\zNS.othername.fooz'ns\.othername\.FOO\'zns.othername.FOOz'ns\.othername\.foo\.BAR\'zns.othername.foo.BAR)rBrCrDrErr rrrrrrrrrrrrcrerr) rqrJr1rrrrrQrrrs r$test_namespace_case_sensitivityz2TestFinderTemplate.test_namespace_case_sensitivitys '#+&   %1!3x%'7#89BZ #CL':F  " 6H$=$=$? 6- + T* +    )/CHu,5578H X &55B; ; 23C55B; ; 67C55B; ;{&9 201 2{2LM 201 2{2RS 645 6- 6 6 6  2 2 2 2 6 6- 6 6 6 6sm2H CG> G##G> G&#G>5 G2G> H G# G>&G/ +G>2G; 7G>>H H  Hcdddddddidii}tjj|| dt|d z i}t tt |i}t j5t j5d D]"}tjj|d $|j|td }|jdk(sJtd}|jdk(sJt!j"t$5tdd d d d d d d d d y #1swYxYw#1swYxYw#1swYy xYw)z The finder should not import ``fullname`` if the intermediate segments don't exist (see pypa/setuptools#4019). r,r'rrzb = 13 config.pyza = 37)r(r(z helloworld.py componentsr4z src/mypkg)r'z mypkg.configmypkg.helloworldzmypkg.componentsmypkg.components.configmypkg.components.helloworldNr+rr*rr,)rBrCrDrErr rrrrrrrrrrrerr)rqrJr1rrrrb helloworlds r$test_intermediate_packagesz-TestFinderTemplate.test_intermediate_packagessL #%!)%-#X#      %1C; 678#CL'2>  " =H$=$=$? = + T* +    )"#<=F88r> !>&'9:J<<2% %%{+ =;< =' = = =& = =' = = = =s=1E B E D5E$E 5D> :EE E  EN)rrr__doc__rrrrrrrrr#r&r.rr&r$rrsC  *@=. 6) V" H%*(0'R'6R*=r&rc ddidddddiddd dd iiidd idd idd id}tjj||dddd}gd}t|||}|t |dz t |dz t |dz t |dz t |dz t |dz dk(sJt t t||}|ddhk(sJt t|}|hdk(sJy)rr(zab = 1r)rr(zd = 1zde = 1)r(eghzfgh = 1zabc = 1z abcxyz = 1z mnopq = 1)rdfotheranother yet_anotherr4r6r7r8)a.b.c a.b.c.x.y.z m.n.o.p.q) ra.br9 a.b.c.x.yr:r4zd.er5f.gzf.g.hr;rr4r5)rr9r:r4r5r;r>>m.nm.n.oa.b.c.xm.n.o.pmr<r=N) rBrCrDrrEsetrrr)rJr1rrrootsr|s r$test_pkg_rootsrFs; "8,W E$M8+D EC-34 5+!<0%{3  E KKeH- "K H +x @E  C X'(8i/0 C C M12    T"8U3 4 5B #u   %e , -B P PP Pr&c eZdZUdZeeedddddddddd Zd ed <eeeeddd ed id eeedzeddded dded ddeeeddd ed ded ddid dZe jje jdk(de jjdejdZy)TestOverallBehaviourz [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name = "mypkg" version = "3.14159" r+rzvar = 42zvar = 13 resource 39)r(rzresource_file.txt)r(r subpackage)r*r+ otherfile.pyr'zdict[str, Any] FLAT_LAYOUTr')r*r+rKr,z [tool.setuptools] packages = ["mypkg", "mypkg.subpackage"] [tool.setuptools.package-dir] "mypkg.subpackage" = "other" r)r(rrJ)r*r+rKr'r6)rrJ) flat-layout src-layout custom-layout namespacer-r.r/layoutctd|||j|g|\}}d}|jddt|g}d|vsJd} |jddt| g}d|vsJd} |jddt| g}d |vsJt |j d } t |j d } t |j d } | j d d| j dd| j dd|jddt| g}d|vsJd|vsJ|jddt| g}d |vsJd|vsJy)Nr'zj try: import otherfile except ImportError as ex: print(ex) r6rRzNo module named 'otherfile'zy import mypkg, mypkg.mod1, mypkg.subpackage.mod2 print(mypkg.mod1.var, mypkg.subpackage.mod2.var) z42 13z import mypkg.subpackage from setuptools._importlib import resources as importlib_resources text = importlib_resources.files(mypkg.subpackage) / "resource_file.txt" print(text.read_text(encoding="utf-8")) rI **/mod1.py **/mod2.py**/resource_file.txtzvar = 17r=r>z var = 781z resource 374z17 781)install_projectEXAMPLESrGrrrorI)rqrJrKrQr%rL_cmd_import_errorr cmd_get_varscmd_get_resourcerr resource_files r$test_editable_installz*TestOverallBehaviour.test_editable_installs% T8T]]6%: =J    hh$/?(@AB,333 hh$|(<=>#~~  hh$/?(@AB###GLL./GLL./W\\*@AB   W5  g6  ' Bhh$|(<=>c!!!3hh$/?(@ABC'''$$$r&N)rrr PYPROJECTrrrL__annotations__rWrerxfailrrrkeysr]rr&r$rHrHBs\ I!+}-!!%%2 #K  #$Y/"=1[12  %Y/ #=1!&w/ :!),7# (%Y/"=1*73I>"-g"6|"D  7&HP [[s||x/8NO [[Xx}}70%8P0%r&rHc~eZdZeej dZedxxedz cc<deddd<dZd Z y ) TestLinkTreerNr*a[ [tool.setuptools] # Temporary workaround: both `include-package-data` and `package-data` configs # can be removed after #3260 is fixed. include-package-data = false package-data = {"*" = ["*.txt"]} [tool.setuptools.packages.find] where = ["src"] exclude = ["*.subpackage*"] rr,r'resource.not_in_manifestc`tjj|j|t |5d}t ddi}|j t}|dz }|dz }|j|j|jd}d|_ t||_ |j|j}|j} t!||||} | ||| t#|j%d } |d z } t'| | t#|j%d dJt#|j%d dJt#|j%d dJt#|j%ddJ dddy#1swYyxYw)Nr4z mypkg-3.14159rrz.auxz.buildbuild_pyTrSzsrc/mypkg/mod1.pyz **/subpackagerTrUz**/resource.not_in_manifest)rBrCrDFILES_Pathrparse_config_filesr rAget_command_obj editable_moderE build_libensure_finalized get_outputsget_output_mappingrrroassert_link_to) rqrJrlrwwheelauxrDrfoutputsoutput_mapping make_treerrs r$test_generated_treez TestLinkTree.test_generated_trees $**X6 8_ O"D <=D  # # %FEV#Cx'E IIK KKM++J7H%)H "!$UH   % % '**,G%88:N!$c59I eWn 5./D"55H 4 *148@ @@.5= ==!78$?G GG!>?FN NN; O O Os E#F$$F-cddg}td|||jg||jgd}d|vsJd}|jddt|g}d |vsJd }|jddt|g}d |vsJd |vsJy) Nr r!r'r6rRz(import mypkg.mod1; print(mypkg.mod1.var)r`zv try: from mypkg import subpackage except ImportError as ex: print(ex) r6rRcannot import name 'subpackage'a8 import mypkg from setuptools._importlib import resources as importlib_resources try: text = importlib_resources.files(mypkg) / "resource.not_in_manifest" print(text.read_text(encoding="utf-8")) except FileNotFoundError as ex: print(ex) zNo such file or directoryrd)rVrgrGr)rqrJrKrrrYr[s r$test_strict_installz TestLinkTree.test_strict_installs#%;<xCdChhSTs{{  hh$/?(@AB0C777 hh$/?(@AB*c111)S000r&N) rrrrrHrWrgrrvrzrr&r$rcrcsW )22<@ AE v   9>E%L45 OD1r&rcz9ignore:.*compat.*:setuptools.SetuptoolsDeprecationWarningcHddg}tjd}td|||g||jgd}d|vsJt t |}dD]%}t |jdd |g}||vr%Jd }|jdd t |g}d |vsJy) Nr zeditable-mode=compatrOr'rxr`)z"import otherfile; print(otherfile)zimport other; print(other)zimport mypkg; print(mypkg)r6rRzc try: from mypkg import subpackage; except ImportError as ex: print(ex) ry)rHrWrVrGcomparable_pathrEr)rJrKrr1r expected_pathrMs r$test_compat_installr~ s !7 8D ) )/ :EGT8U:T: ((O PC 3;;#CM2M$ dhh$'<=>### $ C ((HdF3K0 1C , 33 3r&cdddddd|g|}|j|tj|jgd}d |vsJy ) z3Ensure editable installs work with pbr, issue #3500r6r7r8rr9rstderr)r6rRzimport mypkg.helloz Hello world!N)rGrSTDOUT) pbr_packagerKr%rMrs r$test_pbr_integrationr.s_       C HHS**H+ ((9 :C S  r&cLeZdZdZiej ddediZdZy)TestCustomBuildPya$ Issue #3501 indicates that some plugins/customizations might rely on: 1. ``build_py`` not running 2. ``build_py`` always copying files to ``build_lib`` During the transition period setuptools should prevent potential errors from happening due to those assumptions. rMr2af import pathlib from setuptools import setup from setuptools.command.build_py import build_py as orig class my_build_py(orig): def run(self): super().run() raise ValueError("TEST_RAISE") setup(cmdclass={"build_py": my_build_py}) ctd|||j\}}d|vsJd|vsJ|jgd}d|vsJy)z>Ensure that errors in custom build_py are reported as warningsr'rzValueError: TEST_RAISErxr`N)rVrgrG)rqrJrKrXrs r$test_safeguarded_from_errorsz.TestCustomBuildPy.test_safeguarded_from_errors_sS!$$**E3-444'3...hhSTs{{r&N) rrrr/rHrWrrgrrr&r$rr@s:   ' ' 6 F    E$r&rceZdZdZdZy)TestCustomBuildWheelcZ|jd}Gdd|}||jd<y)N bdist_wheelceZdZfdZxZS)ETestCustomBuildWheel.install_custom_build_wheel..MyBdistWheelcZ|jjdrd}t| S)Nzmacosx-zmacOS platform) plat_namersuperget_tag)rqrX __class__s r$rzMTestCustomBuildWheel.install_custom_build_wheel..MyBdistWheel.get_tagos)>>,,Y7(Aw((r&)rrrr __classcell__)rs@r$ MyBdistWheelrns  ) )r&r)get_command_classcmdclass)rqrwbdist_wheel_clsrs r$install_custom_build_wheelz/TestCustomBuildWheel.install_custom_build_wheelks.00? )? )(4 m$r&cbtjjddit}d|_|j |j |t|}|j|jtttjd}d|vsJy)N module.pyr@r2 dist/*.whleditable)rBrCrDrr set_defaultsrrrmrGrErrro)rq tmpdir_cwdrwrM wheel_files r$test_access_plat_namez*TestCustomBuildWheel.test_access_plat_namexs  ;12~%  ''-T"   dfkk,789 Z'''r&N)rrrrrrr&r$rrjs  4 (r&rcreZdZdZej j ejdk7ddZ y)TestCustomBuildExtcDddlm}Gdd|}||jd<y)Nr) build_extc eZdZy)ITestCustomBuildExt.install_custom_build_ext_distutils..MyBuildExtN)rrrrr&r$ MyBuildExtrs r&rr)distutils.command.build_extrr)rqrw build_ext_clsrs r$"install_custom_build_ext_distutilsz5TestCustomBuildExt.install_custom_build_ext_distutilss!J  &0 k"r&linuxz(compilers may fail without correct setupr/cntjjddidtddggi}t |}d|_|j |j|t|}|j|jtttjd}d|vsJtjdDcgc]}|jd k7s|}}t!|d k(sJ|d j"t%fd t&DsJycc}w) Nzmodule.cr ext_modulesmoduler2rrzmodule.*z.crrc3@K|]}j|ywNr)rextrls r$rzHTestCustomBuildExt.test_distutils_leave_inplace_files..sD#4==%Ds)rBrCrDrrrrrrrmrGrErrrosuffixrprlanyr) rqrrrwrMrpr1rls @r$"test_distutils_leave_inplace_filesz5TestCustomBuildExt.test_distutils_leave_inplace_filess   :r*+ Ih => E"%  //5T"   dfkk,789 Z''' FKK 3Hqqxx47GHH5zQQx}}D1CDDDDIs D22D2N) rrrrrerskipifrrrrr&r$rrs@0 [[ (REEr&rctjjddit}d|_|j t |}|jtdtfi}t|}|j|d|tj|5}|jdddtdj j"DsJy#1swY2xYw) z7Make sure to display useful debugging tips to the user.rr@r2 SimulatedErr) side_effectrkNc3$K|]}d|v yw)zdebugging-tipsNr)rnotes r$rz&test_debugging_tips..sHD4'Hs)rBrCrDrrrrrmtype Exceptionr setattrrerrGrvalue __notes__)rrrrwrMrsimulated_failurervs r$test_debugging_tipsrs KK{H-. >D!D  C b9L846GH | $   HCII4G4GH HH Hs )C++C4errorc>td}t|tsJy)z>Ensure _encode_pth function does not produce encoding warningsutkmilan_ç_utf8N)r isinstancebytes)contents r$test_encode_pthrs+,G gu %% %r&c ||z }|jtjj||g|d}|j ddddddt |g|t j }||fS) Nr4r:r6r7r8rr9r;r)rArBrCrDrGrErr)rlrKrJr1rrLrs r$rVrVs~oG MMO KKeG, *T *) *D (( 4is7|KdK    C C<r&c~djdtd|Dz}|ddz j|dy) a5To use this function, it is necessary to insert new_dir in front of sys.path. The Python process will try to import a ``sitecustomize`` module on startup. If we manipulate sys.path/PYTHONPATH, we can force it to run our code, which invokes ``addsitedir`` and ensure ``.pth`` files are loaded.  )z import sitec3NK|]}dtj|dyw)zsite.addsitedir()N)rfspath)rnew_dirs r$rz_addsitedirs..s$Sw"299W#5"8:Ss#%rzsitecustomize.pyr=r>N)rtuplerI)new_dirsrs r$rrsH ii S(S S TGa[%%11'G1Lr&c|jrJtt|jd}|r(tt |j |k(sJyyyr)__path__riterrErr)rQrrCs r$rrsK ||D&- tDz))+,8 88 r&ct|jr6t|jt|jk(sJy|j}|j}|tj|tjk(sJ|tj |tj k(sJyr) is_symlinkrErstatST_INOST_DEV)filer6 file_stat other_stats r$rprps 4<<>"c%--/&::::IIK ZZ\ %DKK)@@@@%DKK)@@@@r&c~|jjtjdjddS)N/z//)lowerreplacersep) str_with_paths r$r|r|s/    ( ( 5 = =dC HHr&)rrr6rreturnNone)rrErrE)T __future__rrrrrrcopyr importlibrimportlib.machineryrpathlibrtextwraprtypingr unittest.mockr uuidr jaraco.envsrB jaraco.pathrerCrhsetuptools._importlibr r!setuptools.command.editable_wheelr rrrrrrrsetuptools.distrsetuptools.extensionrsetuptools.warningsrrrrdistutils.corerfixturer%rHrSETUP_SCRIPT_STUBrr`rrNrUrXrZrrrrFrHrcfilterwarningsr~ uses_networkrrrrrrrVrrrpr|rr&r$rsZ"   #2 B   )*<"$),-. <  eg(6! " %/  SD N73<<8+4JK 272J 12>L>2%*P#(L?;?;Db0b0J%*PU=U=p .Qbu%u%pP1P1fWX4Y4@!!"''T((:EE@I$G$&%&  M 9AIr&