
    vKg&              
          S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKJ	r	  S SK
Jr  S SKJrJr  S SKJr  S SKrS SKJr  S SKJr  SS	KJr  S
r\" \R4                  " SS5      5      rS\R8                  ;   r\R<                  R?                  \R@                  S:H  =(       a    \SS9r! " S S5      r" " S S\"5      r# " S S\"5      r$\" S5      \" S5      S.\" S5      \" S5      S.\" S5      \" S5      S.S\" S5      0\" S5      \" S5      S .\" S5      S
\" S5      S!./r% " S" S#5      r& " S$ S%\&5      r'S& r(\R<                  RS                  S'5      S( 5       r*S) r+g)*    N)futures)Path)AnyCallable)ZipFile)path)Requirement   )DALSz __import__('setuptools').setup()TIMEOUT_BACKEND_TEST180__pypy__win32z_The combination of PyPy + Windows + pytest-xdist + ProcessPoolExecutor is flaky and problematic)reasonc                       \ rS rSrSS jrSrg)BuildBackendBase"   Nc                 <    Xl         U=(       d    0 U l        X0l        g )N)cwdenvbackend_name)selfr   r   r   s       `/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/setuptools/tests/test_build_meta.py__init__BuildBackendBase.__init__#   s    9"(    )r   r   r   ).Nsetuptools.build_meta)__name__
__module____qualname____firstlineno__r   __static_attributes__ r   r   r   r   "   s    )r   r   c                   N   ^  \ rS rSrSrU 4S jrS\S\S\4   4S jr	S r
S	rU =r$ )
BuildBackend)   zPEP 517 Build Backendc                 X   > [         TU ]  " U0 UD6  [        R                  " SS9U l        g )Nr
   )max_workers)superr   r   ProcessPoolExecutorpool)r   argskwargs	__class__s      r   r   BuildBackend.__init__,   s'    $)&)//A>	r   namereturn.c                    ^ ^ UU 4S jnU$ )<Handles arbitrary function invocations on the build backend.c                    > [         R                  R                  TR                  5      n[	        UTR
                  TR                  5      nS n TR                  R                  [         R                  5      R                  [        5      nTR                  R                  " UT/U Q70 UD6R                  [        5      $ ! [        R                   aK    TR                  R                  SS9  TR                  U5        [         R"                  " S[         S35         g [        R$                  R&                  [(        [*        4 a#    [,        (       a  [         R"                  " S5        e f = f)NF)waitz(Backend did not respond before timeout (z s)z3PyPy frequently fails tests with ProcessPoolExector)osr   abspathr   BuildBackendCallerr   r   r,   submitgetpidresultTIMEOUTr   TimeoutErrorshutdown_killpytestxfailprocessBrokenProcessPoolMemoryErrorOSErrorIS_PYPY)r-   kwrootcallerpidr1   r   s        r   method(BuildBackend.__getattr__.<locals>.method3   s   77??488,D'dhh8I8IJFC
ii&&ryy188Ayy''BtBrBII'RR'' V		""".

3GyPSTUOO55{GL 7LL!VWs   A/B? ?AE(AE(r$   )r   r1   rL   s   `` r   __getattr__BuildBackend.__getattr__0   s    	  r   c                    Uc  g [         R                  " [        [        5         [        R
                  " U[        R                  S:X  a  [        R                  O[        R                  5        S S S 5        g ! , (       d  f       g = f)Nnt)

contextlibsuppressProcessLookupErrorrF   r7   killr1   signalSIGTERMSIGKILL)r   rK   s     r   r@   BuildBackend._killE   sI    ;  !3W=GGC277d?O >==s   A
A77
B)r,   )r   r    r!   r"   __doc__r   strr   r   rN   r@   r#   __classcell__r/   s   @r   r&   r&   )   s3    ? c(: *P Pr   r&   c                   .   ^  \ rS rSrU 4S jrS rSrU =r$ )r9   L   c                 v   > [         TU ]  " U0 UD6  U R                  R                  S5      u  U l        o0l        g )N:)r*   r   r   	partitionbackend_obj)r   r-   r.   _r/   s       r   r   BuildBackendCaller.__init__M   s6    $)&)373D3D3N3Ns3S0	A/r   c                 H   [         R                  " U R                  5        [         R                  R	                  U R
                  5        [        R                  " U R                  5      nU R                  (       a  [        X@R                  5      nOUn[        XQ5      " U0 UD6$ )r4   )r7   chdirr   environupdater   	importlibimport_moduler   rc   getattr)r   r1   r-   rH   modbackends         r   __call__BuildBackendCaller.__call__R   sq    



$((#%%d&7&78c#3#34GGw%t2r22r   )r   rc   )r   r    r!   r"   r   ro   r#   r\   r]   s   @r   r9   r9   L   s    T
3 3r   r9   z
            __import__('setuptools').setup(
                name='foo',
                version='0.0.0',
                py_modules=['hello'],
                setup_requires=['six'],
            )
            C
            def run():
                print('hello')
            setup.pyhello.pyz
            assert __name__ == '__main__'
            __import__('setuptools').setup(
                name='foo',
                version='0.0.0',
                py_modules=['hello'],
                setup_requires=['six'],
            )
            aF  
            variable = True
            def function():
                return variable
            assert variable
            __import__('setuptools').setup(
                name='foo',
                version='0.0.0',
                py_modules=['hello'],
                setup_requires=['six'],
            )
            rs   a  
            # Some packages construct files on the fly, include them in the package,
            # and immediately remove them after `setup()` (e.g. pybind11==2.9.1).
            # Therefore, we cannot use `distutils.core.run_setup(..., stop_after=...)`
            # to obtain a distribution object first, and then run the distutils
            # commands later, because these files will be removed in the meantime.

            with open('world.py', 'w', encoding="utf-8") as f:
                f.write('x = 42')

            try:
                __import__('setuptools').setup(
                    name='foo',
                    version='0.0.0',
                    py_modules=['world'],
                    setup_requires=['six'],
                )
            finally:
                # Some packages will clean temporary files
                __import__('os').unlink('world.py')
            z
        [metadata]
        name = foo
        version = 0.0.0

        [options]
        py_modules=hello
        setup_requires=six
        z7
        def run():
            print('hello')
        )	setup.cfgrt   )ru   rs   rt   c                   2   \ rS rSrSrS r\R                  " \S9S 5       r	S r
S rS r\R                  R                  S	S
5      S 5       r\R                  R                  SS\/5      S 5       rS rS rS rS rS rS rS rS rS rS r\" S5      S\" S5      S.rS r\" S5      SS S!00S".rS# r S$ r!S% r"\R                  R                  S&S'S(0/5      S) 5       r#\R                  R                  S*S+S,/4S-S,/4S.S,/4S/S,/4S0S,S1/4S2S,/4S3S,/4S4S5/4S6S,S1/4S7S,S1/4S8S,S1/4/5      \R                  R                  S9S:S;/5      S< 5       5       r$S= r%S> r&S?\" S@5      0r'SA r(S?\" SB5      0r)SC r*\R                  R                  SDSE5      SF 5       r+SGr,g)HTestBuildMetaBackend   r   c                 (    [        U R                  S9$ )Nr   )r&   r   )r   s    r   get_build_backend&TestBuildMetaBackend.get_build_backend   s    ):):;;r   )paramsc              #      #    [         R                  " UR                  [        U5      S9  UR	                  5          U R                  5       v   S S S 5        g ! , (       d  f       g = f7f)N)prefix)r   buildparamr[   as_cwdr{   )r   tmpdirrequests      r   build_backend"TestBuildMetaBackend.build_backend   s<     

7==V5]]_((** __s   9A(A	A(
A%!A(c                 ^    UR                  5       nS/n[        U5      [        U5      :X  d   eg Nsix)get_requires_for_build_wheelsortedr   r   actualexpecteds       r   !test_get_requires_for_build_wheel6TestBuildMetaBackend.test_get_requires_for_build_wheel   .    ;;=7f~!1111r   c                 ^    UR                  5       nS/n[        U5      [        U5      :X  d   eg r   )get_requires_for_build_sdistr   r   s       r   !test_get_requires_for_build_sdist6TestBuildMetaBackend.test_get_requires_for_build_sdist   r   r   c                 p   [         R                  R                  S5      n[         R                  " U5        UR	                  U5      n[         R                  R                  X#5      n[         R                  R                  U5      (       d   e[         R                  R                  S5      (       a   e[        U5       n[        UR                  5       5      nS S S 5        S W 5       nU Vs/ sH  oR                  S5      (       a  M  UPM     n	n[        U	5      S:X  d   eg ! , (       d  f       NQ= fs  snf )Nz	pip-wheelworld.pyc              3   R   #    U H  oR                  S 5      (       d  M  Uv   M      g7f)z.pyN)endswith).0fs     r   	<genexpr>8TestBuildMetaBackend.test_build_wheel.<locals>.<genexpr>  s     I^zz%7H!!^s   '	'rs   r
   )r7   r   r8   makedirsbuild_wheeljoinisfiler   setnamelistr   len)
r   r   dist_dir
wheel_name
wheel_filezipfilewheel_contentspython_scriptsr   moduless
             r   test_build_wheel%TestBuildMetaBackend.test_build_wheel   s    77??;/
H"..x8
WW\\(7
ww~~j)))) 77>>*----Z G !1!1!34N !
 J^I,KnJJz4J1nK7|q    !  Ls   =D",D3D3"
D0
build_type)wheelsdistc                    SS[        S5      [        S5      S.n[        R                  " U5        [        R                  R	                  SU-   5      nU R                  5       n[        USU-   5      nU" U5      n[        SS	S
S9 nUR                  S5        S S S 5        U" U5      n	[        R                  R                  [        R                  R                  XG5      5      (       d   eXy:w  d   e[        [        R                  R                  XI5      S5      R                  5         U" U5      n
X:X  d   e[        R                  R                  [        R                  R                  XJ5      5      S:  d   eg ! , (       d  f       N= f)Nz$from setuptools import setup
setup()z0.0.1zo
                [metadata]
                name = foo
                version = file: VERSION
                
                [build-system]
                requires = ["setuptools", "wheel"]
                build-backend = "setuptools.build_meta"
                )rs   VERSIONru   pyproject.tomlzpreexisting-build_r   wtutf-8encodingz0.0.2wbr   )r   r   r   r7   r8   r{   rl   openwriter   r   closegetsize)r   r   
tmpdir_cwdfilesr   r   build_methodfirst_resultversion_filesecond_resultthird_results              r   %test_build_with_existing_file_present:TestBuildMetaBackend.test_build_with_existing_file_present	  sH   
 @ #
& 	

577??>J#>?..0}h.CD
 $H- )TG4w' 5 %X.ww~~bggll8BCCCC,,, 	RWW\\(2D9??A#H-,,,wwrww||HCDqHHH 54s   E99
Fsetup_scriptNc                    [        S5      [        S5      SSSSSSSS	S
.0S.nU(       a  X#S'   U R                  5       nUR                  5          [        R                  " U5        UR                  S5      nUR                  S5      nS S S 5        [        R                  " [        R                  R                  USW5      5       n[        UR                  5       5      nS S S 5        [        [        R                  R                  USW5      5       n	[        U	R                  5       5      n
[        U	R!                  S5      S5      n[        U	R!                  S5      S5      n[        U	R!                  S5      S5      nS S S 5        WS1-
  1 Sk:X  d   eW
1 Sk:X  d   eWS:X  d   eSSSSS[        [#        S5      5      -   S[        [#        S5      5      -   4 H  nUW;   a  M   X45       e   WR%                  5       R'                  S5      (       d   eWR%                  5       S:X  d   eg ! , (       d  f       GN= f! , (       d  f       GNb= f! , (       d  f       N= f)Naj  
                [build-system]
                requires = ["setuptools", "wheel"]
                build-backend = "setuptools.build_meta"

                [project]
                name = "foo"
                license = {text = "MIT"}
                description = "This is a Python package"
                dynamic = ["version", "readme"]
                classifiers = [
                    "Development Status :: 5 - Production/Stable",
                    "Intended Audience :: Developers"
                ]
                urls = {Homepage = "http://github.com"}
                dependencies = [
                    "appdirs",
                ]

                [project.optional-dependencies]
                all = [
                    "tomli>=1",
                    "pyscaffold>=4,<5",
                    'importlib; python_version == "2.6"',
                ]

                [project.scripts]
                foo = "foo.cli:main"

                [tool.setuptools]
                zip-safe = false
                package-dir = {"" = "src"}
                packages = {find = {where = ["src"]}}
                license-files = ["LICENSE*"]

                [tool.setuptools.dynamic]
                version = {attr = "foo.__version__"}
                readme = {file = "README.rst"}

                [tool.distutils.sdist]
                formats = "gztar"
                zd
                global-include *.py *.txt
                global-exclude *.py[cod]
                zThis is a ``README``z!---- placeholder MIT license ----fooz__version__ = '0.1'z__version__: strz def main(): print('hello world') )__init__.pyz__init__.pyizcli.pyzdata.txtzpy.typed)r   MANIFEST.inz
README.rstzLICENSE.txtsrcrs   tempfoo-0.1.dist-info/METADATAr   foo-0.1.dist-info/LICENSE.txt"foo-0.1.dist-info/entry_points.txtzfoo-0.1/setup.py>   foo-0.1foo-0.1/srcfoo-0.1/src/foofoo-0.1/PKG-INFOfoo-0.1/setup.cfgfoo-0.1/README.rstfoo-0.1/LICENSE.txtfoo-0.1/MANIFEST.infoo-0.1/pyproject.tomlfoo-0.1/src/foo/cli.pyfoo-0.1/src/foo.egg-infofoo-0.1/src/foo/data.txtfoo-0.1/src/foo/py.typedfoo-0.1/src/foo/__init__.pyfoo-0.1/src/foo/__init__.pyi!foo-0.1/src/foo.egg-info/PKG-INFO$foo-0.1/src/foo.egg-info/SOURCES.txt%foo-0.1/src/foo.egg-info/not-zip-safe%foo-0.1/src/foo.egg-info/requires.txt&foo-0.1/src/foo.egg-info/top_level.txt)foo-0.1/src/foo.egg-info/entry_points.txt-foo-0.1/src/foo.egg-info/dependency_links.txt>   
foo/cli.pyfoo/data.txtfoo/py.typedfoo/__init__.pyfoo/__init__.pyifoo-0.1.dist-info/WHEELfoo-0.1.dist-info/RECORDr   r   foo-0.1.dist-info/top_level.txtr   z!Summary: This is a Python packagezLicense: MITz+Classifier: Intended Audience :: DeveloperszRequires-Dist: appdirszRequires-Dist: ztomli>=1 ; extra == "all"z2importlib; python_version=="2.6" and extra =="all"z$[console_scripts]
foo = foo.cli:main)r   r{   r   r   r   build_sdistr   tarfiler   r7   r   r   getnamesr   r   r[   readr	   stripr   )r   r   r   r   r   
sdist_pathr   tarsdist_contentsr   r   metadatalicenseepointslines                  r    test_build_with_pyproject_config5TestBuildMetaBackend.test_build_with_pyproject_config<  sK    #)+X   1>#8$6@ B "k>
~  ,*..0]]_JJu&226:J&226:J 
 \\"'',,vvzBCs 0N D RWW\\&&*=>' !1!1!34N7<<(DEwOH',,'FGQG',,'KLgVG	 ? !3 44 9
 
 	
 
0  "
 
 	
 
 ==== 09$K0K$L MM+RSTU
D 8#5d%55#
 ~~(()?@@@@}}"IIIIC _
 DC ?>s%   9H'H9A+I'
H69
I
Ic                 4   [        S5      [        S5      [        S5      S.nU R                  5       nUR                  5          [        R                  " U5        UR                  S5      nUR                  S5      nS S S 5        US-  R                  5       (       d   eUS-  R                  5       (       d   eUS-  R                  5       (       a   eUS	-  R                  5       (       a   eUS
-  R                  5       (       a   eUS-  R                  5       (       a   eUS-  R                  5       (       a   eUS-  R                  5       (       a   e[        R                  " [        R                  R                  USW5      5       n[        UR                  S5      R                  5       S5      nUR                  5       nSU;  d   e S S S 5        [!        [        R                  R                  USW5      5       n	[        U	R                  S5      S5      n
U	R#                  5       nSU;  d   e S S S 5        WW
4 H#  nS H
  nX;   a  M
   e   S H
  nX;  a  M
   e   M%     g ! , (       d  f       GN= f! , (       d  f       N= f! , (       d  f       N]= f)NaR  
                [build-system]
                requires = ["setuptools", "wheel"]
                build-backend = "setuptools.build_meta"

                [project]
                name = "foo"
                description = "This is a Python package"
                version = "42"
                dependencies = ["six"]
                zO
                def run():
                    print('hello')
                z
                __import__('setuptools').setup(
                    name='bar',
                    version='13',
                )
                )r   rt   rs   r   ztemp/foo-42.tar.gzztemp/foo-42-py3-none-any.whlztemp/bar-13.tar.gzztemp/bar-42.tar.gzztemp/foo-13.tar.gzztemp/bar-13-py3-none-any.whlztemp/bar-42-py3-none-any.whlztemp/foo-13-py3-none-any.whlzfoo-42/PKG-INFOr   zbar-13/PKG-INFOzfoo-42.dist-info/METADATAzbar-13.dist-info/METADATA)z	Name: foozVersion: 42)z	Name: barzVersion: 13)r   r{   r   r   r   r   r   existsr   r   r7   r   r[   extractfiler   r   r   r   )r   r   r   r   r   r   r   pkg_infomembersr   r   filer   s                r   (test_static_metadata_in_pyproject_config=TestBuildMetaBackend.test_static_metadata_in_pyproject_config  sa    #
  )
: ..0]]_JJu&226:J&226:J 
 --55777777??AAAA1199;;;;1199;;;;1199;;;;;;CCEEEE;;CCEEEE;;CCEEEE\\"'',,vvzBCs3??+<=BBDgNHllnG$G333 D
 RWW\\&&*=>'7<<(CDgNH&&(G.g=== ?
 h&D4|#| 54''' 5 '1 _ DC
 ?>s%   9I&AI8=4J	&
I58
J	
Jc                    [         R                  R                  S5      n[         R                  " U5        UR	                  U5      n[         R                  R                  [         R                  R                  X#5      5      (       d   eg )Nz	pip-sdist)r7   r   r8   r   r   r   r   r   r   r   
sdist_names       r   test_build_sdist%TestBuildMetaBackend.test_build_sdist  sV    77??;/
H"..x8
ww~~bggll8@AAAAr   c                    [         R                  R                  S5      n[         R                  " U5        UR	                  U5      n[         R                  R                  [         R                  R                  X#S5      5      (       d   eg )Npip-dist-infoMETADATA)r7   r   r8   r    prepare_metadata_for_build_wheelr   r   )r   r   r   	dist_infos       r   %test_prepare_metadata_for_build_wheel:TestBuildMetaBackend.test_prepare_metadata_for_build_wheel
  sX    77???3
H!BB8L	ww~~bggll8
KLLLLr   c                     S H  n[         R                  " USS9  M     UR                  S5      n[         R                  R	                  [         R                  R                  US5      5      (       d   eg)za
Some users might pass metadata_directory pre-populated with `.tox` or `.venv`.
See issue #3523.
)z?.tox/python/lib/python3.10/site-packages/attrs-22.1.0.dist-infozD.tox/python/lib/python3.10/site-packages/autocommand-2.2.1.dist-infoz>.nox/python/lib/python3.10/site-packages/build-0.8.0.dist-infoz4.venv/python3.10/site-packages/click-8.1.3.dist-infoz5venv/python3.10/site-packages/distlib-0.3.5.dist-infoz4env/python3.10/site-packages/docutils-0.19.dist-infoT)exist_okr   r  N)r7   r   r  r   r   r   )r   r   pre_existingr  s       r   test_prepare_metadata_inplace2TestBuildMetaBackend.test_prepare_metadata_inplace  sX    

L KKt4
 "BB3G	ww~~bggll9jABBBBr   c                     [         R                  R                  S5      nUR                  U5      n[         R                  R	                  [         R                  R                  X#5      5      (       d   eg )Ndist)r7   r   r8   r   r   r   r  s       r   test_build_sdist_explicit_dist3TestBuildMetaBackend.test_build_sdist_explicit_dist#  sL     77??6*"..x8
ww~~bggll8@AAAAr   c                    [         R                  R                  S5      n[         R                  " U5        UR	                  U5      n[         R                  R                  [         R                  R                  X#5      5      (       d   e[         R                  R                  S5      n[         R                  R                  U5      (       d  [         R                  R                  S5      n[        USSS9 nUR                  5       nS S S 5        [        USSS9 nUR                  WR                  SS	5      5        S S S 5        [        R                  " U5        [         R                  " U5        UR	                  S5      n[         R                  R                  [         R                  R                  [         R                  R                  S5      U5      5      (       d   eg ! , (       d  f       N= f! , (       d  f       N= f)
N	out_sdistrs   ru   rtr   r   r   zversion='0.0.0'zversion='0.0.1')r7   r   r8   r   r   r   r   r   r   r   r   replaceshutilrmtree)r   r   sdist_into_directoryr	  	setup_locfile_handlercontents          r   test_build_sdist_version_change4TestBuildMetaBackend.test_build_sdist_version_change*  sS   !ww{;
()"../CD
ww~~bggll+?LMMMM
 GGOOJ/	ww~~i((4I)TG4"'')G 5)TG4w/@BSTU 5 	*+
()"..{;
ww~~bggll277??;+GTUUUU 5444s   7G$"G5$
G25
Hc                    [        S5      S[        S5      S.n[        R                  " U5        U R                  5       nUR	                  S5      n[
        R                  " [        R                  R                  SU5      5       n[        S UR                  5        5       5      (       d   e S S S 5        g ! , (       d  f       g = f)N
                __import__('setuptools').setup(
                    name='foo',
                    version='0.0.0',
                    py_modules=['hello']
                )r   r   )rs   rt   r   r   c              3   *   #    U H
  nS U;   v   M     g7f)r   Nr$   r   r1   s     r   r   NTestBuildMetaBackend.test_build_sdist_pyproject_toml_exists.<locals>.<genexpr>Z  s     KND'4/N   r   r   r   r{   r   r   r   r7   r   anyr   r   r   r   r   
targz_pathr   s         r   &test_build_sdist_pyproject_toml_exists;TestBuildMetaBackend.test_build_sdist_pyproject_toml_existsC  s     "
$ 	

5..0"..v6
\\"'',,vz:;sKCLLNKKKKK <;;   (B66
Cc                 l   [         R                  " [        S   5        U R                  5       nUR	                  S5      n[
        R                  " [        R                   R                  SU5      5       n[        S UR                  5        5       5      (       d   e S S S 5        g ! , (       d  f       g = f)Nr   r   c              3   *   #    U H
  nS U;   v   M     g7frs   Nr$   r+  s     r   r   HTestBuildMetaBackend.test_build_sdist_setup_py_exists.<locals>.<genexpr>d  s     EndzT)nr-  )r   r   defnsr{   r   r   r   r7   r   r/  r   )r   r   r   r1  r   s        r    test_build_sdist_setup_py_exists5TestBuildMetaBackend.test_build_sdist_setup_py_exists\  sx     	

58..0"..v6
\\"'',,vz:;sEcllnEEEEE <;;s   3(B%%
B3c                    [        S5      S[        S5      S.n[        R                  " U5        U R                  5       nUR	                  S5      n[
        R                  " [        R                  R                  SU5      5       n[        S UR                  5        5       5      (       a   e S S S 5        g ! , (       d  f       g = f)Nz
        __import__('setuptools').setup(
            name='foo',
            version='0.0.0',
            py_modules=['hello']
        )r   z"
        exclude setup.py
        )rs   rt   r   r   c              3   *   #    U H
  nS U;   v   M     g7fr7  r$   r+  s     r   r   STestBuildMetaBackend.test_build_sdist_setup_py_manifest_excluded.<locals>.<genexpr>~  s     I.$:-.r-  r.  r0  s         r   +test_build_sdist_setup_py_manifest_excluded@TestBuildMetaBackend.test_build_sdist_setup_py_manifest_excludedf  s      
" 	

5..0"..v6
\\"'',,vz:;sI#,,.IIIIII <;;r4  c                     [        S5      S[        S5      S.n[        R                  " U5        U R                  5       nUR	                  S5        g )Nr)  r   zE
                [sdist]
                formats=zip
                rs   rt   ru   r   )r   r   r   r{   r   )r   r   r   r   s       r   3test_build_sdist_builds_targz_even_if_zip_indicatedHTestBuildMetaBackend.test_build_sdist_builds_targz_even_if_zip_indicated  sR     
$ 	

5..0!!&)r   z
            __import__('setuptools').setup(
                name='foo',
                version=__import__('hello').__version__,
                py_modules=['hello']
            )z__version__ = "0.0.0"z9
            [sdist]
            formats=zip
            rB  c                     [         R                  " U R                  5        U R                  5       n[        R
                  " [        SS9   UR                  S5        S S S 5        g ! , (       d  f       g = f)Nz^No module named 'hello'$matchr   )r   r   _relative_path_import_filesr{   rA   raisesImportErrorr   r   r   r   s      r   %test_build_sdist_relative_path_import:TestBuildMetaBackend.test_build_sdist_relative_path_import  sL    

4334..0]];.IJ%%f- KJJ   
A%%
A3zX
            [project]
            name = "proj"
            version = "42"
            projr   r   )r   r   c                     [        [        U5      R                  S5      5      nU(       d   eU H@  nUR                  5       (       a  M  [        R
                  " U5      R                  S:  a  M@   e   g)z?All files in the directory should be either links or hard linksz**/*r   N)listr   glob
is_symlinkr7   statst_nlink)r   
parent_dirr   r  s       r   _assert_link_tree&TestBuildMetaBackend._assert_link_tree  sU    T*%**623uD??$$(>(>(BBB r   c                    [         R                  " U R                  5        U R                  5       n[	        S5      R                  5       (       a   eUR                  S5        [	        S5      R                  5       (       a   eg)z
Sanity check to ensure tests with --mode=strict are different from the ones
without --mode.

--mode=strict should create a local directory with a package tree.
The directory should not get created otherwise.
r   r   N)r   r   _simple_pyproject_exampler{   r   r   build_editablerK  s      r   %test_editable_without_config_settings:TestBuildMetaBackend.test_editable_without_config_settings  sg     	

4112..0=''))))$$V,='')))))r   c                 j   SSS/0n[         R                  " U R                  5        U R                  5       n[	        S5      R                  5       (       a   e[	        S5      R                  5         UR                  SU5        UR                  SU5        [	        S5      R                  5       (       d   eg )Nz--build-option	build_extz	--inplacer   zbuild/proj-42-py3-none-any.whl)	r   r   rZ  r{   r   r   mkdirr  r   r   r   config_settingsr   s       r   test_build_wheel_inplace-TestBuildMetaBackend.test_build_wheel_inplace  s    +k;-GH

4112..0=''))))W66wP!!'?;45<<>>>>r   rb  zeditable-modestrictc                 ^   [         R                  " 0 U R                  ES0 0E5        [        S5      R	                  5       (       a   eU R                  5       nUR                  SU5        UR                  SUS5        U R                  [        [        S5      R                  S5      5      5        g )N_metar   r   z__editable__.*)r   r   rZ  r   r   r{   #prepare_metadata_for_build_editabler[  rW  nextrR  ra  s       r   "test_editable_with_config_settings7TestBuildMetaBackend.test_editable_with_config_settings  s    

Bd44BgrBC=''))))..099'?S$$V_gFtDM$6$67G$HIJr   )setup_literalrequirementsz'foo'r   z['foo']z'foo\n'z	'foo\n\n'z['foo', 'bar']barz'# Has a comment line\nfoo'z'foo # Has an inline comment'z'foo \\\n >=3.0'zfoo>=3.0z
'foo\nbar'z'foo\nbar\n'z['foo\n', 'bar\n']	use_wheelTFc                    [        S5      R                  US9[        S5      S.n[        R                  " U5        U R	                  5       nU(       a  UR
                  nOUR                  n[        U5      nU" 5       n	U[        U	5      :X  d   eg )Na  
                from setuptools import setup

                setup(
                    name="qux",
                    version="0.0.0",
                    py_modules=["hello"],
                    setup_requires={setup_literal},
                )
            )rl  rq   rr   )r   formatr   r   r{   r   r   r   )
r   rl  rm  ro  r   r   r   get_requiresr   r   s
             r   test_setup_requires(TestBuildMetaBackend.test_setup_requires  s    & 	 f=f1
* 	

5..0(EEL(EEL ,'6&>)))r   c                     [        S5      [        S5      SSS.n[        R                  " U5        U R                  5       nUR	                  5       nUS/:X  d   eg )Nzd
                [project]
                name = "proj"
                version = "42"
            z
                __import__('setuptools').setup(
                    setup_requires=["foo"],
                    py_modules = ["hello", "world"]
                )
            z'hello'z'world')r   rs   rt   r   r   )r   r   r   r{   r   )r   r   r   r   setup_requiress        r   'test_setup_requires_with_auto_discovery<TestBuildMetaBackend.test_setup_requires_with_auto_discovery  si    
 #  "!#
& 	

5..0&CCE%(((r   c                 
   [        S5      [        S5      S.n[        R                  " U5        U R                  5       n[        R                  R                  S5      n[        R                  " U5        UR                  U5        g )NaN  
                        from setuptools import setup

                        setup(
                            name="qux",
                            version="0.0.0",
                            py_modules=["hello"],
                            setup_requires=["does-not-exist >99"],
                        )
                    z[
                    def run():
                        print('hello')
                    rr   r  )r   r   r   r{   r7   r8   r   r  )r   r   r   r   r   s        r    test_dont_install_setup_requires5TestBuildMetaBackend.test_dont_install_setup_requires5  so    	 
* 	

5..077???3
H 	66x@r   rs   aD  
            import os
            import sys

            __import__('setuptools').setup(
                name='foo',
                version='0.0.0',
            )

            sys_argv = os.path.abspath(sys.argv[0])
            file_path = os.path.abspath('setup.py')
            assert sys_argv == file_path
            c                     [         R                  " U R                  5        U R                  5       n[        R
                  " [        5         UR                  S5        S S S 5        g ! , (       d  f       g = fNr   )r   r   _sys_argv_0_passthroughr{   rA   rI  AssertionErrorr   rK  s      r   test_sys_argv_passthrough.TestBuildMetaBackend.test_sys_argv_passthroughh  sH    

4//0..0]]>*%%f- +**s   A&&
A4a  
            import os
            assert os.path.isabs(__file__)
            __import__('setuptools').setup(
                name='foo',
                version='0.0.0',
                py_modules=['hello'],
                setup_requires=['six'],
            )
            c                     [         R                  " U R                  5        U R                  5       nUR	                  S5        g r}  )r   r   _setup_py_file_abspathr{   r   rK  s      r   test_setup_py_file_abspath/TestBuildMetaBackend.test_setup_py_file_abspath}  s0    

4../..0!!&)r   
build_hook)r   r   c                     SS0n[         R                  " U5        [        R                  " S5      n[        R
                  " [        US9   [        X5      " S5        S S S 5        g ! , (       d  f       g = f)Nrs   r   zNo distribution was found.rF  r   )r   r   reescaperA   rI  
ValueErrorrl   )r   r   r  r   msgs        r   test_build_with_empty_setuppy2TestBuildMetaBackend.test_build_with_empty_setuppy  sN    R 

5ii45]]:S1M.v6 211rN  r$   )-r   r    r!   r"   r   r{   rA   fixturer9  r   r   r   r   markparametrizer   SETUP_SCRIPT_STUBr   r  r
  r  r  r  r&  r2  r:  r?  rC  r   rH  rL  rZ  rW  r\  rc  rj  rs  rw  rz  r~  r  r  r  r  r#   r$   r   r   rw   rw      s   *L< ^^5!+ "+
2
2
!( [[\+=>0I ?0Id [[^d4E-FGEJ HEJN=(~BMC"BV2L2FJ4*2 
 ,
#$. 
 +,	!C*? [[./81L0MNK OK [[)ug %!E7#u~.+eW5-w7 :,/UEN+uen-"UEN3	
  [[[4-8#* 9!"#*J)8AD 	D
$. 	D	
*
 [[\+IJ7 K7r   rw   c                   $    \ rS rSrSrS rS rSrg)TestBuildMetaLegacyBackendi  z setuptools.build_meta:__legacy__c                     [         R                  " U R                  5        U R                  5       nUR	                  S5        g r}  )r   r   rH  r{   r   rK  s      r   rL  @TestBuildMetaLegacyBackend.test_build_sdist_relative_path_import  s0    

4334..0!!&)r   c                     [         R                  " U R                  5        U R                  5       nUR	                  S5        g r}  )r   r   r~  r{   r   rK  s      r   r  4TestBuildMetaLegacyBackend.test_sys_argv_passthrough  s0    

4//0..0!!&)r   r$   N)r   r    r!   r"   r   rL  r  r#   r$   r   r   r  r    s    5L**r   r  c                 .   Sn[         R                  " [        U5      SS.5        / SQnU R                  XAS9R	                  5       nSU;  d   eSU;   d   e0 [
        R                  ESS	0En/ SQnU R                  XAUS
9R	                  5       nSU;   d   eg )Nz
    [build-system]
    requires = ["setuptools"]
    build-backend = "setuptools.build_meta"
    [project]
    name = "myproj"
    version = "42"
    r   )r   zmymod.py)pipinstallz--no-build-isolationz-er   )r   z#running setup.py develop for myprojzcreated wheel for myprojSETUPTOOLS_ENABLE_FEATURESzlegacy-editable)r   r   )r   r   r   runlowerr7   rh   )venvr   r   	pyprojectcmdoutputr   s          r   test_legacy_editable_installr    s    I 	JJ$y/rBC @CXXcX&,,.F0>>>%/// JRZZ
I57H
IC
?CXXc3X/557F0F:::r   z/ignore::setuptools.SetuptoolsDeprecationWarningc                     U R                  U5        SnUS-  R                  [        U5      SS9  [        SS9nUR	                  5       / :X  d   eg)zHSetuptools should be resilient to setup.py with ``sys.exit(0)`` (#3973).zr
        import sys, setuptools
        setuptools.setup(name='foo', version='0.0.0')
        sys.exit(0)
        rs   r   r   r   rz   N)rg   
write_textr   r&   r   monkeypatchtmp_pathsetuppyrn   s       r   test_sys_exit_0_in_setuppyr    sY     hG
 
&&tG}w&G(?@G//1R777r   c                     U R                  U5        SnUS-  R                  USS9  [        R                  " [        SS9   [        SS9nUR                  5         S S S 5        g ! , (       d  f       g = f)	Nz"import sys; sys.exit('some error')rs   r   r   z
some errorrF  r   rz   )rg   r  rA   rI  
SystemExitr&   r   r  s       r   test_system_exit_in_setuppyr    s^    h2G
&&w&A	z	6,CD,,. 
7	6	6s    A##
A1),rR   rj   r7   r  r   rV   sysr   
concurrentr   pathlibr   typingr   r   r   r   rA   jaracor   packaging.requirementsr	   textwrapr   r  intgetenvr=   builtin_module_namesrG   r  skipifplatform
pytestmarkr   r&   r9   r9  rw   r  r  filterwarningsr  r  r$   r   r   <module>r     s     	 	   
         . 6  bii.6
7
00
0 [[LLG'   
) ) P#  PF3) 3, 	
 
& 

 
( 
 
. 	D
4 

 
( 

 7
Q|	~j
7 j
7Z*!5 *$;0 MN
8 O
8/r   