Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
test_editable_install.cpython-313.pyc441 linesDownload Raw Back to __pycache__
1�

2`j��3��SSKJr SSKrSSKrSSKrSSKrSSKrSSKJr SSK	J4r5 SSKJr SSK
Jr SSKJr SSKJr SS	KJr SS6KJr SSKrSSKrSSKrSSKJr SSKJr SSK J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r( SS
K)J*r* SSK+J,r, SSK-J.r. SSK/J0r0J1r1 SSK2J3r3 \Rh"SS/S9S5r5\"S5\"S5Rm5SSS\"S5\"S5SSS .0S!.r7S"r8\RrRu\RS#:HS$S%9\RrRwS&0\7ES'\80E\7/5S(55r<S)r=S*r>"S+S,5r?"S-S.5r@S/rA"S0S15rBS2rC"S3S45rD"S5S65rE\RrR�S75S85rG\RrR�S95rI"S:S;5rJ"S<S=5rK"S>S?5rLS@rM\RrR�SA5SB5rNSCrOSDrPSErQSHSFjrRSISGjrSg)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�_TopLevelFinder�editable_wheel)�Distribution)�	Extension)�SetuptoolsDeprecationWarning�)�contexts�7namespaces)�	run_setup�strict�lenient)�paramsc�.�URS:XaSS/$/$)Nr�--config-settings�editable-mode=strict)�param)�requests �XD:\code\apps\devtools\python\Lib\site-packages\setuptools/tests/test_editable_install.py�
editable_optsr%*s���}�}�� �#�%;�<�<�
�I�a�        [build-system]8        requires = ["setuptools"]9        build-backend = "setuptools.build_meta"10 11        [project]12        name = "mypkg"13        version = "3.14159"14        license = {text = "MIT"}15        description = "This is a Python package"16        dynamic = ["readme"]17        classifiers = [18            "Development Status :: 5 - Production/Stable",19            "Intended Audience :: Developers"20        ]21        urls = {Homepage = "https://github.com"}22 23        [tool.setuptools]24        package-dir = {"" = "src"}25        packages = {find = {where = ["src"]}}26        license-files = ["LICENSE*"]27 28        [tool.setuptools.dynamic]29        readme = {file = "README.rst"}30 31        [tool.distutils.egg_info]32        tag-build = ".post0"33        zr        global-include *.py *.txt34        global-exclude *.py[cod]35        prune dist36        prune build37        zThis is a ``README``z!---- placeholder MIT license ----�mypkga                import sys38                from importlib.metadata import PackageNotFoundError, version39 40                try:41                    __version__ = version(__name__)42                except PackageNotFoundError:43                    __version__ = "unknown"44                a
                from importlib.resources import read_text45                from . import __version__, __name__ as parent46                from .mod import x47 48                data = read_text(parent, "data.txt")49                print(__version__, data, x)50                zx = ''zHello World)�__init__.pyz__main__.py�mod.pyzdata.txt)�pyproject.toml�MANIFEST.inz51README.rstzLICENSE.txt�srcz __import__('setuptools').setup()�darwin�pypa/setuptools#4328��reason�files�setup.pyc	��US-nUR5 [RRX$S9 SSSSSS[	U5/UQn[UR
U55 /S	QnUR
U5R5S52:XdeUS-RSS
S9 US-RSS
S9 UR
U5R5S:Xdeg)Nr'��prefix�python�-m�pip�install�--no-build-isolation�-e)r6r7r'z3.14159.post0 Hello Worldzsrc/mypkg/data.txt�foobar�utf-8��encodingzsrc/mypkg/mod.py�x = 42z3.14159.post0 foobar 42)	�mkdir�jaraco�path�build�str�print�run�strip�53write_text)�tmp_path�venvr1r%�project�cmds      r$�test_editable_with_pyprojectrN{s����� �G��M�M�O�54�K�K���e��,�	��
�����G��	�55�	�C�56�$�(�(�3�-��57#�C��8�8�C�=��� �$?�?�?�?��#�#�/�/��7�/�K��!�!�-�-�h��-�I��8�8�C�=��� �$=�=�=�=r&c	��S[S5SS0SS.0n[RRX0S9 US-nSS	S58SSS
[	U5/UQn[UR
U55 /SQnUR
U5R5S:Xdeg)Nr'ac                [build-system]59                requires = ["setuptools", "wheel"]60                build-backend = "setuptools.build_meta"61 62                [project]63                name = "mypkg"64                version = "3.14159"65 66                [tool.setuptools]67                packages = ["pkg"]68                py-modules = ["mod"]69                r(za = 4�b = 2)r*�pkgr)r4r6r7r8r9r:r;)r6�-cz$import pkg, mod; print(pkg.a, mod.b)z4 2�rrBrCrDrErFrGrH�rJrKr%r1rLrMs      r$�test_editable_with_flat_layoutrU�s����$���"�7�+��#70�
�E�*�K�K���e��-��� �G�	��
�����G��	�71�	�C�72�$�(�(�3�-��73B�C��8�8�C�=��� �E�)�)�)r&c	��S[S5SS.0n[RRX0S9 US-nSSSS	S74S[	U5/UQn[UR
U55 /SQnUR
U5R5S
:Xdeg)Nr'a>                [build-system]75                requires = ["setuptools", "wheel"]76                build-backend = "setuptools.build_meta"77 78                [project]79                name = "mod"80                version = "3.14159"81 82                [tool.setuptools]83                py-modules = ["mod"]84                rP)r*r)r4r6r7r8r9r:r;)r6rRzimport mod; print(mod.b)�2rSrTs      r$� test_editable_with_single_modulerX�s����$��
��85�
�E�&�K�K���e��-��� �G�	��
�����G��	�86�	�C�87�$�(�(�3�-��886�C��8�8�C�=��� �C�'�'�'r&c��\rSrSrSr\RRSS5\RRSS5S55rSr	g	)89�TestLegacyNamespaces��c�Z�[R"[SS9nUS-nUR5 SnUH�n[R90"XSS9nU UR
5nURU5 [SSS	9n	[U	5n91U92R5 U93RS945RnU95RXK5 SSS5 SSS5 M� [URS55n[!U5[!U5:Xdeg!,(df   NO=f!,(df   M�=f)Nz .*namespace_packages parameter.*��matchz.installation_dir)z	myns.pkgAz	myns.pkgB�myns.n.pkgA�myns.n.pkgB�42)�versionr2�config)�96stop_after�	dist_infoz*-nspkg.pth)�pytest�warnsrrAr�build_namespace_package�context�chdirrr�finalize_options�get_finalized_command�name�_install_namespaces�list�glob�len)
�selfrJ�monkeypatch�deprecation�installation_dir�examplesrmrQ�ctx�distrM�
editable_namer1s
             r$�test_nspkg_file_is_unique�.TestLegacyNamespaces.test_nspkg_file_is_unique�s����l�l�(�0R�97��$�&9�9����� �98���D��4�4�X�T�R�C��k�1�1�3�s��	�	�#�� ���A��$�T�*���$�$�&� #� 9� 9�+� F� K� K�
��'�'�(8�H�
4�����%�*�*�=�9�:���5�z�S��]�*�*�*�4�3����s%�
D�A#D99�D�100 101D�D�102D*	�impl)�
pkg_resources�ns)zmyns.nc103��Sn[R"X#S3US9n[R"X#S3US9nUS-RUSS9 US-RUSS9 USSn	U	RS	5 UR	S104SSS
[U5/U	Q5 UR	S105SSS
S[U5/U	Q5 UR	S106SSUSUS3/5 g)a107Installing two packages sharing the same namespace, one installed108naturally using pip or `--single-version-externally-managed`109and the other installed in editable mode should leave the namespace110intact and both packages reachable by import.111(Ported from test_develop).112zq        [build-system]113        requires = ["setuptools"]114        build-backend = "setuptools.build_meta"115        z.pkgA)r|z.pkgBr*r=r>Nr:r6r7r8r9r;rRzimport z.pkgA; import )rrhrI�appendrGrE)116rrrKrJr~r|r%�build_system�pkg_A�pkg_B�optss117          r$�!test_namespace_package_importable�6TestLegacyNamespaces.test_namespace_package_importables���$��118�2�2�8�t�5�\�PT�U���2�2�8�t�5�\�PT�U��	�!�	!�-�-�l�W�-�M�	�!�	!�-�-�l�W�-�M��Q������*�+����(�D�%��C��J�F��F�G����(�D�%��D�#�e�*�L�t�L�M����(�D�G�B�4�~�b�T��"G�H�Ir&�N)119�__name__�120__module__�__qualname__�__firstlineno__rzrf�mark�parametrizer��__static_attributes__r�r&r$rZrZ�sO��+�4�[�[����	121���[�[���T�;�/�J�0��Jr&rZc�&�\rSrSrSrSrSrSrg)�TestPep420Namespacesi*c122�8�[R"US5n[R"US5nUSSnURS5 URSSSS[	U5/UQ5 URSSSSS	[	U5/UQ5 UR/S123Q5 g)z�124Installing two packages sharing the same namespace, one installed125normally using pip and the other installed in editable mode126should allow importing both packages.127r_r`Nr:r6r7r8r9r;)r6rRz&import myns.n.pkgA; import myns.n.pkgB)r�build_pep420_namespace_packager�rGrE)rrrKrJr%r�r�r�s       r$r��6TestPep420Namespaces.test_namespace_package_importable+s����9�9�(�M�R���9�9�(�M�R���Q������*�+����(�D�%��C��J�F��F�G����(�D�%��D�#�e�*�L�t�L�M����K�Lr&c128���S[S5SS0S.0n[RRXBS9 US-n[R129"US5n[R130"US5nUS	S	nUR
S1315 URSSS
S[U5/UQ5 URSSS
SS[U5/UQ5 URSSS
SS[U5/UQ5 UR/SQ5 g	)z@Currently users can create a namespace by tweaking `package_dir`�pkgAat                    [build-system]132                    requires = ["setuptools", "wheel"]133                    build-backend = "setuptools.build_meta"134 135                    [project]136                    name = "pkgA"137                    version = "3.14159"138 139                    [tool.setuptools]140                    package-dir = {"myns.n.pkgA" = "src"}141                    r(�a = 1)r*r,r4r`zmyns.n.pkgCNr:r6r7r8r9r;)r6rRz#from myns.n import pkgA, pkgB, pkgC)	rrBrCrDrr�r�rGrE)	rrrKrJr%r1r�r��pkg_Cr�s	         r$�&test_namespace_created_via_package_dir�;TestPep420Namespaces.test_namespace_created_via_package_dir:s���
�"(��
#�&�w�/��142��&	�����%��1��6�!���9�9�(�M�R���9�9�(�M�R���Q������*�+����(�D�%��C��J�F��F�G����(�D�%��D�#�e�*�L�t�L�M����(�D�%��D�#�e�*�L�t�L�M����H�Ir&c�r�S[S5SSSSS.S.[SS	.0n[RR	X2S1439 US-nS/nURSS
SSSS[
U5/UQ5 UR/SQ5nUR5S:XdeSnURSS[U5/5nSU;deg)aSometimes users might specify an ``include`` pattern that ignores parent144packages. In a normal installation this would ignore all modules inside the145parent packages, and make them namespaces (reported in issue #3504),146so the editable mode should preserve this behaviour.147r�ar                    [build-system]148                    requires = ["setuptools", "wheel"]149                    build-backend = "setuptools.build_meta"150 151                    [project]152                    name = "pkgA"153                    version = "3.14159"154 155                    [tool.setuptools]156                    packages.find.include = ["mypkg.*"]157                    �zb = 1r�)r(zpkgA.py)r(zother.py�nr+)r*r'r+r4r:r6r7r8�-vr9r;)r6rRz'from mypkg.n import pkgA; print(pkgA.a)�1z}        try:158            import mypkg.other159        except ImportError:160            print("mypkg.other not defined")161        rRzmypkg.other not definedN)r�EXAMPLErBrCrDrGrErH)rrrKrJr1r�r��outrMs        r$�0test_namespace_accidental_config_in_lenient_mode�ETestPep420Namespaces.test_namespace_accidental_config_in_lenient_mode\s���
�"(��
#�$&� '�')�#*��� '�}�5�/�162��6	�����%��1��6�!��'�'�����(�D�%��y�$��E�163�R�T�R�S��h�h�R�S���y�y�{�c�!�!�!����h�h��$��s��4�5��(�C�/�/�/r&r�N)r�r�r�r�r�r�r�r�r�r&r$r�r�*s��
M� J�D00r&r�c164���US-n[RVs/sH\nSU;dMUR[R5(dM1U[	U5R[R5-PM^ nnUHnUR
SS9 M [U5 [[R[RR[[U55S9n[RSSSS	[U5S165[U5S/	UQn[ R""X�S9 [$R&"5S
:XaSOSn	X9-S-n166[ R""U167/US9 gs snf)z6168Editable install to a prefix should be discoverable.169r5z
site-packagesT)�parents)�170PYTHONPATHr7r8r9�171--editablez--prefixr:)�env�Windows�Scripts�bin�sampleN)�sysrC�172startswithr5r�relative_torA�_addsitedirs�dict�os�environ�pathsep�join�maprE�173executable�174subprocess�175check_call�platform�system)rJ�sample_projectr%r5rC�site_packages_all�spr�rMr��exes           r$�test_editable_with_prefixr��s8����
 �F�176�H�H���D��d�"�	4�'+���s�z�z�'B�	4���d��'�'��177�178�3�3���� ��179������ ��"�#�180�r�z�z�b�j�j�o�o�c�#�?P�6Q�&R�181S�C�����
����N����F����182��C����#�'� ���(�I�5�)�5�C�183�,��184!�C����3�%�S�)��=s�185E�"E�/Ec�Z�\rSrSrSrSrSrSrSrSr	Sr186S	rS187rSr
SrS
rSrg)�TestFinderTemplatei���This test focus in getting a particular implementation detail right.188If at some point in time the implementation is changed for something different,189this test can be modified or even excluded.190c�4�0n[XU5 US"5 g)Nr9)�exec)rr�finder�locs   r$�install_finder�!TestFinderTemplate.install_finder�s�����V�#���I��r&c���SSSS0S.0SS0S.n[RRX!S	9 [US191-5[US-5S.n[	[[55U05n[R"5 [R"5 S
H#n[RRUS5 M% URU5 [S5n[S5n[S5nURS:XdeURS:Xde[US-R55n	[!X�5 SSS5 SSS5 g!,(df   N=f!,(df   g=f)N�pkg1r��mod1.pyza = 42)r(�subpkg�mod2.pyza = 43��src1�src2r4z	src1/pkg1z	src2/mod2)r��mod2)r��pkg1.subpkg�pkg1.subpkg.mod1r�r�r�r��*�+zsrc1/pkg1/subpkg)rBrCrDrErrr�192save_paths�save_sys_modulesr��modules�popr�r�a�resolve�assert_path)193rrrJr1�mapping�template�mod�mod1r�r��expecteds194          r$�
test_packages� TestFinderTemplate.test_packages�s;���#%�(�(�3�����)�195��	�����%��1���;�.�/���;�.�/�196��$�C���L�'�2�>��
�
 �
 �
"�H�$=�$=�$?�J��������T�*�K�
����)� �!3�4�D� ��(�D�"�=�1�F��6�6�R�<��<��6�6�R�<��<��H�'9�9�B�B�D�E�H���)�%@�
"�
"�$?�$?��
"�
"�s%�<E�B'E197�9E�198 199E	�E�200E)c���SSSS.0n[RRX!S9 S[US-50nS/0n[	[[55X45n[R"5 [R"5 SH#n[RRUS5 M% URU5 [S5n[R"U5S	-n[US-R!55n	[#Xy5 UR$S201:XdeUR'SS9S:XdeSSS5 SSS5 g!,(df   N=f!,(df   g=f)
NrQ�a = 13�abc)r(�text.txtr4�ns.othernamer~�r~r�r��
r=r>)rBrCrDrErrrr�r�r�r�r�r�r�importlib_resourcesr1r�r�r��	read_text)202rrrJr1r�rr�r�rQ�textr�s203          r$�test_namespace�!TestFinderTemplate.test_namespace�s����e�D�E�������%��1�!�3�x�%�'7�#8�9���B�Z�204�#�C���L�'�F��
�
 �
 �
"�H�$=�$=�$?�-��������T�*�.�
����)���/�C�&�,�,�S�1�J�>�D��H�u�,�5�5�7�8�H���&��5�5�B�;��;��>�>�7�>�3�u�<�<�<�%@�
"�
"�$?�$?��
"�
"�s%�+E�B-E�/E�205E	�206E�207Ec��SSSS000SSS00S.n[RRX!S9 [US	-5[US208-5S.nS[US-5[US
-5/0n[	[[55X45n[R"5 [R"5 SH#n[RRUS5 M% URU5 [S5n[S5n[US	-R55n	[Xy5 UR S:XdeUR"S:XdeSSS5 SSS5 g!,(df   N=f!,(df   g=f)Nr~r�r(r�r��b = 37r�r4zsrc1/ns/pkg1zsrc2/ns)�ns.pkgAr~r�r�)r~r��ns.mod2r�r�r��%)rBrCrDrErrrr�r�r�r�r�r�rr�r�r��b)209rrrJr1r��namespaces_r�r�r�r�r�s210          r$�test_combine_namespaces�*TestFinderTemplate.test_combine_namespaces�sJ���F�]�H�$=�>�?��I�x�0�1�211��	�����%��1��8�n�4�5��h��*�+�212���c�(�V�"3�4�c�(�V�:K�6L�M�N��#�C���L�'�G��
�
 �
 �
"�H�$=�$=�$?�3��������T�*�4�
����)� ��+�D� ��+�D��H�~�5�>�>�@�A�H���'��6�6�R�<��<��6�6�R�<��<�%@�
"�
"�$?�$?��
"�
"�s%�E/�0BE�
E/�213E,	�(E/�/214E=c�z�SSS00SSS00S.n[RR5nURU5 [RR	U5 SS	S215S.SS
/S.n[U5n[
U[[555n[SUR555nSSS5 [R"5 [R"5 WSH#n[RR!US5 M% UR#W5 [%S5n	[%S5n216[US-R'55n[[)U	R*5R'55U:Xde[US-R'55n[[)U217R*5R'55U:XdeU	R,S:XdeU218R.S:XdeSSS5 SSS5 g!,(df   GN`=f!,(df   N)=f!,(df   g=f)zw219Users may attempt to combine namespace packages in a nested way via220``package_dir`` as shown in pypa/setuptools#4248.221�222my_packagezmy_module.pyr��my_package2z
my_module2.pyr�)r,r��	%PEP 517%zsrc/my_packagezsrc2/my_package2)�different_name�different_name.subpkgr�r�)�script_name�package_dir�packagesc3�Z# �UH!upURS5(dMUv� M# g7f)z.pyN��endswith)�.0�k�vs   r$�	<genexpr>�DTestFinderTemplate.test_combine_namespaces_nested.<locals>.<genexpr>,s"���W�&A�d�a�Q�Z�Z�PU�EV���&A�s�+�	+Nrzdifferent_name.my_modulez different_name.subpkg.my_module2zsrc/my_package/my_module.pyzsrc2/my_package2/my_module2.pyr�r�)rBrC�DirectoryStackrirDrrrEr�next�get_implementationrr�r�r�r�r�r�rr�r�__file__r�r�)rrrJr1�stack�attrsrxr��coder�r�r�r�s            r$�test_combine_namespaces_nested�1TestFinderTemplate.test_combine_namespaces_nesteds���!�>�8�"<�=�"�_�h�$?�@�223��224���*�*�,��
�]�]�8�
$��K�K���e�$�*�&6�-?� �.�/F�G�
�E� ��&�D�$�T�3�u�w�<�8�F��W�f�&?�&?�&A�W�W�D�%��
 �
 �
"�H�$=�$=�$?��Z�(��������T�*�)�
����%� �!;�<�D� �!C�D�D��H�'D�D�M�M�O�P�H��t�D�M�M�*�2�2�4�5��A�A�A��H�'G�G�P�P�R�S�H��t�D�M�M�*�2�2�4�5��A�A�A��6�6�R�<��<��6�6�R�<��<�%@�
"�
"�%�
$��%@�$?��
"�
"�s1�A3H	�
H,�#DH�8H,�	225H�226H)	�%H,�,227H:c�t�SSSS000SSSS000SSSS000S	.n[RRX!S2289 0nS[US-5/0n[	[[55X45nSS
5n[R"5 [R"5 SSS/UQ7H#n[RRUS5 M% URU5 [S5nURS:Xde[R "["5 [S5 SSS5 [RR%[US-55 [S5n	U	RS:Xde[R "["5 [S5 SSS5 [RR%[US-55 [S5n229U230RS:XdeSSS5 SSS5 g!,(df   N�=f!,(df   Ny=f!,(df   N9=f!,(df   g=f)N�parent�childzone.py�x = 1ztwo.py�x = 2zthree.pyzx = 3)�project1�project2�project3r4zproject1/parentc3�,# �UH231nSU3v� M g7f)z
parent.child.Nr�)rrms  r$r�CTestFinderTemplate.test_dynamic_path_computation.<locals>.<genexpr>Ks���K�3J�4�-��v�&�3J���)�one�two�threezparent.childzparent.child.onerzparent.child.twor�zparent.child.threer�)rBrCrDrErrrr�r�r�r�r�r�r�xrf�raises�ImportErrorr�)rrrJr1r�r�r��modsr�rrr s           r$�test_dynamic_path_computation�0TestFinderTemplate.test_dynamic_path_computation?s���"�G�h��-@�#A�B�!�G�h��-@�#A�B�!�G�j�'�-B�#C�D�232��233	�����%��1����#�h�1B�&B�"C�!D�E��#�C���L�'�G��K�3J�K��
�
 �
 �
"�H�$=�$=�$?� �.�.�H�4�H��������T�*�I�
����)�� 2�3�C��5�5�A�:��:����{�+��0�1�,�
�H�H�O�O�C��:� 5�6�7�� 2�3�C��5�5�A�:��:����{�+��2�3�,�
�H�H�O�O�C��:� 5�6�7�!�"6�7�E��7�7�a�<��<�+%@�
"�
"�,�+��,�+��!%@�$?��
"�
"�sW�H)�A8H�G6�A*H�H�AH�%H)�6234H�H�235H�H�236H&	�"H)�)237H7c�@�SSS00n[RRX!S9 S[US-50n[	[[55U05n[R"5 [R"5 [RRSS5 URU5 [R"[SS9 [!S5 SSS5 SSS5 SSS5 g!,(df   N=f!,(df   N(=f!,(df   g=f)NrQr(zfrom . import pkgr4r]�rBrCrDrErrrr�r�r�r�r�r�rfr$r%r�rrrJr1r�r�s     r$�test_no_recursion�$TestFinderTemplate.test_no_recursioncs���
��2��238��239	�����%��1�
�3�x�%�'�(�240��$�C���L�'�2�>��
�
 �
 �
"�H�$=�$=�$?��K�K�O�O�E�4�(�����)����{�%�8��e�$�9�	%@�
"�
"�9�8��	%@�$?��
"�
"�s=�'D�=AC>�C-�C>�D�-241C;�7C>�>242D	�D�243Dc��SSSS0S.0n[RRX!S9 S[US-50n[	[[55U05n[R"5 [R"5 [RRSS5 [RRSS5 URU5 [R"[SS9 [!S5 SSS5 SSS5 SSS5 g!,(df   N=f!,(df   N(=f!,(df   g=f)	N�foor�r()r(�barr4zfoo.barr<r]r*r+s     r$�test_similar_name�$TestFinderTemplate.test_similar_namexs����!�!�2���244��	�����%��1�
�3�x�%�'�(�245��$�C���L�'�2�>��
�
 �
 �
"�H�$=�$=�$?��K�K�O�O�E�4�(��K�K�O�O�I�t�,�����)����{�(�;��h�'�<�%@�
"�
"�246<�;��%@�$?��
"�
"�s=�*D2�A+D!�+D�7D!�?D2�247D�D!�!248D/	�+D2�2249Ec��SSSSSS.S.0n[RRX!S9 S[US-50n[	[[55U05n[R"5 [R"5 [RRSS5 URU5 [R"[SS	9 [!S2505 SSS5 [R"[SS	9 [!S5 SSS5 [R"[S
S	9 [!S5 SSS5 [R"[SS	9 [!S5 SSS5 [R"[SS	9 [!S5 SSS5 [!S5nUR"S:Xde[!S5nUR"S:XdeSSS5 SSS5 g!,(df   GN=f!,(df   N�=f!,(df   N�=f!,(df   N�=f!,(df   N�=f!,(df   Nm=f!,(df   g=f)Nr/r�rr)r(�lowercase.py)r(r4r0r4z'FOO'r]�FOOz'foo\.LOWERCASE'z
foo.LOWERCASEz'foo\.bar\.Lowercase'zfoo.bar.Lowercasez251'foo\.BAR'zfoo.BAR.lowercasezFOO.bar.lowercasez
foo.lowercaserzfoo.bar.lowercaser!)rBrCrDrErrrr�r�r�r�r�r�rfr$r%rr#)rrrJr1r�r�r�s      r$�test_case_sensitivity�(TestFinderTemplate.test_case_sensitivity�s����!� '�#%�$+���	252��	�����%��1��3�x�%�'�(�253��$�C���L�'�2�>��
�
 �
 �
"�H�$=�$=�$?��K�K�O�O�E�4�(�����)����{�'�:��e�$�;����{�2E�F��o�.�G����{�2K�L��1�2�M����{�-�@��1�2�A����{�'�:��1�2�;� ��0�C��5�5�A�:��:�� 3�4�C��5�5�A�:��:�/%@�
"�
"�;�:��G�F��M�L��A�@��;�:��!%@�$?��
"�
"�s��,I�AH7�
G!�!H7�:G3�!H7�'H�3!H7�H� !H7�H&�
AH7�I�!254G0�+H7�3255H�=H7�256H�H7�257H#�H7�&258H4�0H7�7259I	�I�260Ic�T�SSSSS.S.0n[RRX!S9 S[US-50nS	/0n[	[[55X45n[R"5 [R"5 S261H#n[RRUS5 M% URU5 [S5n[US-R55n[Xx5 UR S:Xde[S5n	U	R"S
:Xde[S5n262U263R$S:Xde[&R("[*SS9 [S5 SSS5 [&R("[*SS9 [S5 SSS5 [&R("[*SS9 [S5 SSS5 SSS5 SSS5 g!,(df   Ny=f!,(df   N]=f!,(df   NA=f!,(df   NJ=f!,(df   g=f)NrQr�r�zc = 42)r(zbar.py)r(r/r4r�r~r�r�zns.othername.foor�zns.othername.foo.barr�z'NS'r]zNS.othername.fooz'ns\.othername\.FOO\'zns.othername.FOOz'ns\.othername\.foo\.BAR\'zns.othername.foo.BAR)rBrCrDrErrrr�r�r�r�r�r�rr�r�r�r��crfr$r%)rrrJr1r�rr�r�rQr�r/r0s           r$�test_namespace_case_sensitivity�2TestFinderTemplate.test_namespace_case_sensitivity�s����'�#+�&���264��	�����%��1�!�3�x�%�'7�#8�9���B�Z�265�#�C���L�'�F��
�
 �
 �
"�H�$=�$=�$?�-��������T�*�.�
����)���/�C��H�u�,�5�5�7�8�H���&��5�5�B�;��;�� 2�3�C��5�5�B�;��;�� 6�7�C��5�5�B�;��;����{�&�9��0�1�:����{�2L�M��0�1�N����{�2R�S��4�5�T�-%@�
"�
"� :�9��N�M��T�S��-%@�$?��
"�
"�sm�.H�CH�G�"!H�G&�!H�0G7�<H�H�266G#�H�&267G4�0H�7268H�H�269H	�H�270H'c���SSSSSSS0S.00n[RRX!S	9 S[US271-50n[	[[55U05n[R"5 [R"5 SH#n[RRUS5 M% URU5 [S
5nURS:Xde[S5nURS:Xde[ R""[$5 [S5 SSS5 SSS5 SSS5 g!,(df   N=f!,(df   N(=f!,(df   g=f)zp272The finder should not import ``fullname`` if the intermediate segments273don't exist (see pypa/setuptools#4019).274r,r'r�r�zb = 13�	config.pyza = 37)r(r=z
helloworld.py�275componentsr4z	src/mypkg)r'zmypkg.config�mypkg.helloworldzmypkg.components�mypkg.components.config�mypkg.components.helloworldNr@r�r?r�rA)rBrCrDrErrrr�r�r�r�r�r�rr�r�rfr$r%)rrrJr1r�r�r�rc�276helloworlds        r$�test_intermediate_packages�-TestFinderTemplate.test_intermediate_packages�s,��
��#%�!)�%-�#�X�#�	�	�277��	�����%��1��C��;� 6�7�8��#�C���L�'�2�>��
�
 �
 �
"�H�$=�$=�$?���������T�*��
����)�"�#<�=�F��8�8�r�>�!�>�&�'9�:�J��<�<�2�%�%�%����{�+��;�<�,�'%@�
"�
"�&,�+��'%@�$?��
"�
"�s=�.E�BE	�D8�E	�'E�8278E�E	�	279E	�E�280E(r�N)r�r�r�r��__doc__r�r�r�r�rr'r,r1r6r:rCr�r�r&r$r�r��sC���281�282*�@=�. �6) �V" �H%�*(�0'�R'6�R*=r&r�c283���SS0SS.SSS0S.SS	SS284000SS0SS0SS
0S.n[RRXS9 SSSS.n/SQn[X2U5nU[	US-5[	US-5[	US-5[	US-5[	US-5[	US-5S.:Xde[[
[X4555nUSS1:Xde[[U55nU1Sk:Xdeg)r�r(zab = 1r�)r�r(zd = 1zde = 1)r(�e�g�hzfgh = 1zabc = 1z285abcxyz = 1z	mnopq = 1)r��d�f�other�another�yet_anotherr4rLrMrN)�a.b.c�a.b.c.x.y.z�	m.n.o.p.q)r��a.brO�	a.b.c.x.yrPrJzd.erK�f.gzf.g.hrQr�rJrK)r�rOrPrJrKrQrT>�mrR�m.n�m.n.o�a.b.c.x�m.n.o.prSN)	rBrCrDrrE�setr�rr)rJr1rr�rootsr~s      r$�test_pkg_rootsr\s5��"�8�,�W�
E�$�M�8�+D�
E��C�-��3�4�
5���+�!�<�0�%�{�3�

�E��K�K���e��-�� �"��K�286�H�
 ��x�@�E��
��C��
 ��X��'�(��8�i�/�0�
��C��
 �
��C��
 ���M�1�2�
����287
�T�"�8�3�
4�	5�B�
�#�u�����	�
%�e�
,�	-�B�
�P�P�P�Pr&c288���\rSrSr%Sr\"\5\SSSSSSSS.S	.S289.rS\S'\\"\5\SSS
\S
0S.\"\5\"S5-\SSS\S
SS.\S
SS.\"\5\SSS
\S
S\S
SS.0S.S.r	\290RR\
RS:HSS9\291RRS\	R!55S55rSrg)�TestOverallBehaviouri@z�        [build-system]292        requires = ["setuptools"]293        build-backend = "setuptools.build_meta"294 295        [project]296        name = "mypkg"297        version = "3.14159"298        r+r�zvar = 42zvar = 13�resource 39)r(r�zresource_file.txt)r(r��299subpackage)r*r+�otherfile.pyr'zdict[str, Any]�FLAT_LAYOUTr')r*r+rar,z�                [tool.setuptools]300                packages = ["mypkg", "mypkg.subpackage"]301 302                [tool.setuptools.package-dir]303                "mypkg.subpackage" = "other"304                r�)r(r�r`)r*r+rar'rL)r�r`)�flat-layout�305src-layout�
custom-layout�	namespacer-r.r/�layoutc���[SX!URU/UQ76upVSnURSS[U5/5nSU;deSn	URSS[U	5/5nSU;deSn306URSS[U3075/5nS	U;de[	URS30855n[	URS55n[	URS55n
UR
S
SS9 UR
SSS9 U
R
SSS9 URSS[U	5/5nSU;deSU;deURSS[U3095/5nS	U;deSU;deg)Nr'zj        try:310            import otherfile311        except ImportError as ex:312            print(ex)313        r6rRzNo module named 'otherfile'zy        import mypkg, mypkg.mod1, mypkg.subpackage.mod2314        print(mypkg.mod1.var, mypkg.subpackage.mod2.var)315        z42 13z�        import mypkg.subpackage316        from setuptools._importlib import resources as importlib_resources317        text = importlib_resources.files(mypkg.subpackage) / "resource_file.txt"318        print(text.read_text(encoding="utf-8"))319        r_�320**/mod1.py�321**/mod2.py�**/resource_file.txtzvar = 17r=r>z	var = 781zresource 374z17 781)�install_project�EXAMPLESrGrrrprI)rrrJrKrgr%rL�_�cmd_import_errorr��cmd_get_vars�cmd_get_resourcer�r��
resource_files              r$�test_editable_install�*TestOverallBehaviour.test_editable_install�s���%��T�T�]�]�6�%:�322�=J�323�324��325���h�h��$��/?�(@�A�B��,��3�3�3����h�h��$��|�(<�=�>���#�~��~����h�h��$��/?�(@�A�B����#�#�#��G�L�L��.�/���G�L�L��.�/���W�\�\�*@�A�B�
����326�W��5�����g��6�� � ��'� �B��h�h��$��|�(<�=�>���c�!�!�!��3�����h�h��$��/?�(@�A�B���C�'�'�'���$�$�$r&r�N)r�r�r�r��	PYPROJECTrr�rb�__annotations__rmrfr��xfailr�r�r��keysrsr�r�r&r$r^r^@s\���I�!��+��}�-���!�!�%�%2��327�	
#�K��
� #�$�Y�/�"�=�1���[��1�2�	328�%�Y�/����	�#�=�1��!�&�w�/�	�:��!��)�,�7�#329�(%�Y�/�"�=�1���*�7�3�I�>�"-�g�"6�|�"D���	330331�7&�H�P�[�[���s�|�|�x�/�8N��O��[�[���X�x�}�}��7�0%�8�P�0%r&r^c��\rSrSr\"\RS5r\S==\"S5-
ss'S\SSS'S	r	S332r333Srg)
�TestLinkTreei�rdr*a[        [tool.setuptools]334        # Temporary workaround: both `include-package-data` and `package-data` configs335        # can be removed after #3260 is fixed.336        include-package-data = false337        package-data = {"*" = ["*.txt"]}338 339        [tool.setuptools.packages.find]340        where = ["src"]341        exclude = ["*.subpackage*"]342        r�r,r'�resource.not_in_manifestc�d�[RRURUS9 [	U5 Sn[SS05nUR
5 [5nUS-nUS-nUR5 UR5 URS5nSUl343[U5UlUR5 UR5nUR5n	[!X2XV5n344U345"XHU	5 [#UR%S	55nUS346-n['X�5 [#UR%S5S5be[#UR%S5S5be[#UR%S
5S5be[#UR%S5S5beSSS5 g!,(df   g=f)Nr4z
mypkg-3.14159r�r�z.auxz.build�build_pyTrizsrc/mypkg/mod1.pyz
**/subpackagerjrkz**/resource.not_in_manifest)rBrCrD�FILES�_Pathr�parse_config_filesr347rA�get_command_obj�
editable_moderE�	build_lib�ensure_finalized�get_outputs�get_output_mappingrrrp�assert_link_to)
rrrJrmrx�wheel�auxrDr}�outputs�output_mapping�	make_treer�r�s
             r$�test_generated_tree� TestLinkTree.test_generated_tree�su�������$�*�*�X��6�
�8�_�"�D���� <�=�D��#�#�%��F�E��V�#�C��x�'�E��I�I�K��K�K�M��+�+�J�7�H�%)�H�"�!$�U��H���%�%�'��*�*�,�G�%�8�8�:�N�!�$�c�9�I��e�n�5������.�/�D��"5�5�H��4�*������1�4�8�@�@�@������.��5�=�=�=�����!7�8�$�?�G�G�G�����!>�?��F�N�N�N�;�_�_�s�E#F!�!348F/c��SS/n[SX!UR/UQ76 UR/SQ5nSU;deSnURSS[U5/5nS	U;deS349nURSS[U5/5nSU;deSU;deg)
Nr r!r'�r6rRz(import mypkg.mod1; print(mypkg.mod1.var)razv        try:350            from mypkg import subpackage351        except ImportError as ex:352            print(ex)353        r6rR�cannot import name 'subpackage'a8        import mypkg354        from setuptools._importlib import resources as importlib_resources355        try:356            text = importlib_resources.files(mypkg) / "resource.not_in_manifest"357            print(text.read_text(encoding="utf-8"))358        except FileNotFoundError as ex:359            print(ex)360        zNo such file or directoryr{)rlr~rGr)rrrJrKr�r�rorqs       r$�test_strict_install� TestLinkTree.test_strict_install�s���#�%;�<��������C�d�C��h�h�S�T���s�{��{����h�h��$��/?�(@�A�B��0�C�7�7�7����h�h��$��/?�(@�A�B��*�c�1�1�1�)�S�0�0�0r&r�N)r�r�r�r�rr^rmr~rr�r�r�r�r&r$rzrz�sW���)�2�2�<�@�A�E�	�361��v�362	� ���9>�E�%�L���4�5� O�D1r&rzz9ignore:.*compat.*:setuptools.SetuptoolsDeprecationWarningc�T�SS/n[RSn[SXU/UQ76 UR/SQ5nSU;de[	[U55nSH'n[	URSS	U/55nXT;aM'e S363nURSS	[
U5/5nSU;deg)Nr zeditable-mode=compatrer'r�ra)z"import otherfile; print(otherfile)zimport other; print(other)zimport mypkg; print(mypkg)r6rRzc    try:364        from mypkg import subpackage;365    except ImportError as ex:366        print(ex)367    r�)r^rmrlrG�comparable_pathrEr)rJrKr�r1r��
expected_pathrMs       r$�test_compat_installr�s���
 �!7�8�D� �)�)�/�:�E��G�T�U�:�T�:�368�(�(�O�369P�C��3�;��;�#�C��M�2�M���370�d�h�h��$��'<�=�>���#�#�#�
��C��(�(�H�d�F�3�K�0�3711�C�,��3�3�3r&c��SSSSSSU/UQnURU[RS9 UR/SQ5nS	U;deg372)z3Ensure editable installs work with pbr, issue #3500r6r7r8r�r9r���stderr)r6rRzimport mypkg.hellozHello world!N)rGr��STDOUT)�pbr_packagerKr%rMr�s     r$�test_pbr_integrationr�,s_��	��
�����	�373�	�C�	�H�H�S��*�*�H�+�374�(�(�9�375:�C��S� � � r&c�T�\rSrSrSr0\RSES\"S50ErSr	Sr376g)	�TestCustomBuildPyi>a377Issue #3501 indicates that some plugins/customizations might rely on:378 3791. ``build_py`` not running3802. ``build_py`` always copying files to ``build_lib``381 382During the transition period setuptools should prevent potential errors from383happening due to those assumptions.384rcr2af            import pathlib385            from setuptools import setup386            from setuptools.command.build_py import build_py as orig387 388            class my_build_py(orig):389                def run(self):390                    super().run()391                    raise ValueError("TEST_RAISE")392 393            setup(cmdclass={"build_py": my_build_py})394            c��[SX!UR5up4SU;deSU;deUR/SQ5nSU;deg)z>Ensure that errors in custom build_py are reported as warningsr'rzValueError: TEST_RAISEr�raN)rlr~rG)rrrJrKrnr�s     r$�test_safeguarded_from_errors�.TestCustomBuildPy.test_safeguarded_from_errors]sO��!��$�$�*�*�E���-��4�4�4�'�3�.�.�.��h�h�S�T���s�{��{r&r�N)r�r�r�r�rEr^rmrr~r�r�r�r&r$r�r�>s:���
�395�396'�397'�
�3986�
��F�
�
399�
�E�$r&r�c� �\rSrSrSrSrSrg)�TestCustomBuildWheelihc�X�URS5n"SSU5nX1RS'g)N�bdist_wheelc�(^�\rSrSrU4SjrSrU=r$)�ETestCustomBuildWheel.install_custom_build_wheel.<locals>.MyBdistWheelilc�d>�URRS5(aSn[TU]
5$)Nzmacosx-zmacOS platform)�	plat_namer��super�get_tag)rrrn�	__class__s  �r$r��MTestCustomBuildWheel.install_custom_build_wheel.<locals>.MyBdistWheel.get_tagms,����>�>�,�,�Y�7�7�(�A��w��(�(r&r�)r�r�r�r�r�r��
__classcell__)r�s@r$�MyBdistWheelr�ls
���
)�
)r&r�)�get_command_class�cmdclass)rrrx�bdist_wheel_clsr�s    r$�install_custom_build_wheel�/TestCustomBuildWheel.install_custom_build_wheelis,���0�0��?��	)�?�	)�(4�
�
�m�$r&c�f�[RRSS05 [5nSUlUR5 UR
U5 [U5nUR5 UR5 [[[5RS555nSU;deg)N�	module.pyr@r2�400dist/*.whl�editable)rBrCrDrr��set_defaultsr�rr�rGrErrrp)rr�401tmpdir_cwdrxrM�402wheel_files     r$�test_access_plat_name�*TestCustomBuildWheel.test_access_plat_namevs���	�����;��1�2��~��%��������'�'��-��T�"���������	���d�f�k�k�,�7�8�9�403��Z�'�'�'r&r�N)r�r�r�r�r�r�r�r�r&r$r�r�hs��4�(r&r�c�t�\rSrSrSr\RR\RS:gSS9S5r404Srg)	�TestCustomBuildExti�c�B�SSKJn "SSU5nX1RS'g)Nr)�	build_extc��\rSrSrSrg)�ITestCustomBuildExt.install_custom_build_ext_distutils.<locals>.MyBuildExti�r�N)r�r�r�r�r�r�r&r$�405MyBuildExtr��s��r&r�r�)�distutils.command.build_extr�r�)rrrx�
build_ext_clsr�s    r$�"install_custom_build_ext_distutils�5TestCustomBuildExt.install_custom_build_ext_distutils�s��J�	��	�&0�
�
�k�"r&�linuxz(compilers may fail without correct setupr/c�^�[RRSS05 S[SS/5/0n[	U5nSUlUR
5 URU5 [U5nUR5 UR5 [[[5RS555nSU;de[5RS5Vs/sHofRS	:wdMUPM nn[!U5S406:XdeUSR"m[%U4Sj[&55(degs snf)
Nzmodule.cr��ext_modules�moduler2r�r�zmodule.*z.crrc3�F># �UHnTRU5v� M g7f�Nr)r�extrms  �r$r�HTestCustomBuildExt.test_distutils_leave_inplace_files.<locals>.<genexpr>�s����D�1C�#�4�=�=��%�%�1C�s�!)rBrCrDrrr�r�r�rr�rGrErrrp�suffixrqrm�anyr)	rrr�rrxrMr��pr1rms	        @r$�"test_distutils_leave_inplace_files�5TestCustomBuildExt.test_distutils_leave_inplace_files�s���	�����:�r�*�+��I�h���=�>�407���E�"��%��������/�/��5��T�"���������	���d�f�k�k�,�7�8�9�408��Z�'�'�'� �F�K�K�409�3�H�3�q�x�x�4�7G��3��H��5�z�Q�����Q�x�}�}���D�1C�D�D�D�D�D��Is�D?�6D?r�N)r�r�r�r�r�rfr��skipifr�r�r�r�r�r&r$r�r��s@��0��[�[��������(R���E��Er&r�c���[RRSS05 [5nSUlUR5 [
U5nUR5 [S[405n[U"5S9nURUSU5 [R"U5nUR5 SSS5 [SWR R"55(deg!,(df   N<=f)	z7Make sure to display useful debugging tips to the user.r�r@r2�SimulatedErr)�side_effectrlNc3�,# �UH410nSU;v� M g7f)zdebugging-tipsNr�)r�notes  r$r�&test_debugging_tips.<locals>.<genexpr>�s���H�4G�D��4�'�4G�r)rBrCrDrr�r�rr��type�	Exceptionr411�setattrrfr$rGr��value�	__notes__)r�rsrxrMr��simulated_failurerws       r$�test_debugging_tipsr��s���412�K�K���{�H�-�.��>�D�!�D������413��414�C���������b�9�L����8������4�6G�H�	���|�	$�����	�415%��H�C�I�I�4G�4G�H�H�H�H�H�416%�	$�s�'C.�.417C<�errorc�H�[S5n[U[5(deg)z>Ensure _encode_pth function does not produce encoding warningsutkmilan_ç_utf8N)r
�418isinstance�bytes)�contents r$�test_encode_pthr��s"���+�,�G��g�u�%�%�%�%r&c���X -nUR5 [RRX5S9 /UQSPnUR	SSSSSS[U5/UQ[RS	9nXV4$)419Nr4r:r6r7r8r�r9r;r�)rArBrCrDrGrEr�r�)rmrKrJr1r�rLr�s       r$rlrl�sx���o�G��M�M�O�420�K�K���e��,�*�T�*�)�*�D�421�(�(�	�4���i��s�7�|�K�d�K�� � ���C��<�r&c�x�SRS[SU55-5nUSS-RUSS9 g)	a%To use this function, it is necessary to insert new_dir in front of sys.path.422The Python process will try to import a ``sitecustomize`` module on startup.423If we manipulate sys.path/PYTHONPATH, we can force it to run our code,424which invokes ``addsitedir`` and ensure ``.pth`` files are loaded.425�426)zimport sitec3�X# �UH nS[R"U5<S3v� M" g7f)zsite.addsitedir(�)N)r��fspath)r�new_dirs  r$r�_addsitedirs.<locals>.<genexpr>�s$���S�(�w�"�2�9�9�W�#5�"8��:�(�s�(*rzsitecustomize.pyr=r>N)r��tuplerI)�new_dirsr�s  r$r�r��sH���i�i��427�S�(�S�428S�	T��G��a�[�%�%�1�1�'�G�1�Lr&c���UR(aP[[UR5S5nU(a)[[	U5R55U:Xdegggr�)�__path__r�iterrErr�)rQr�rCs   r$r�r��sK��429�|�|��D����&��-����t�D�z�)�)�+�,��8�8�8��r&c��UR5(a7[UR55[UR55:XdegUR5nUR5nU[RU[R:XdeU[R430U[R431:Xdegr�)�432is_symlinkrEr��stat�ST_INO�ST_DEV)�filerL�	file_stat�433other_stats    r$r�r��s���������4�<�<�>�"�c�%�-�-�/�&:�:�:�:��I�I�K�	��Z�Z�\�434�����%��D�K�K�)@�@�@�@�����%��D�K�K�)@�@�@�@r&c�~�UR5R[RS5RSS5$)N�/z//)�lower�replacer��sep)�
str_with_paths r$r�r��s/����� �(�(�����5�=�=�d�C�H�Hr&)r�rrLr�return�None)rrErrE)T�435__future__rr�r�r�r�r��copyr�	importlibr�importlib.machineryr�pathlibr�textwrapr�typingr	�
unittest.mockr436�uuidr�jaraco.envsrB�jaraco.pathrfrCr�setuptools._importlibrr��!setuptools.command.editable_wheelr
rrrrrrr�setuptools.distr�setuptools.extensionr�setuptools.warningsrr�rr�distutils.corer�fixturer%rHr��SETUP_SCRIPT_STUBr�rwr�rNrUrXrZr�r�r�r\r^rz�filterwarningsr��uses_networkr�r�r�r�r�r�rlr�r�r�r�r�r&r$�<module>rsZ��"�	����437��#�2��������
��B�	�	�	�)�*�<�"�$�����)�,�-��.���	��<�	���e�g�(�6��!��438�"��	��%�/439��SD��N7�������3�<�<�8�+�4J��K�������2�7�2�J� 1�2����>��L�>�2%*�P#(�L=J�=J�@b0�b0�J%*�PU=�U=�p440.Q�bu%�u%�pP1�P1�f�����W�X�4�Y�4�@�����!��!�"'�'�T(�(�:E�E�@I�$�����G�$�&�%�&�	�441M� 9�A�Ir&
codekingpro/portable-devtools · Team Ai