
    ,h	              
          d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	m
Z
 d dlmZ d dlmZmZ d dlmZ d dlZd dlmZ d dlmZ d dlmZ d	d
lmZ dZ e ej:                  dd            Zdej>                  v Z ejB                  jE                  ejF                  dk(  xr e d      Z$ G d d      Z% G d de%      Z& G d de%      Z' ed       ed      d ed       ed      d ed       ed      dd ed      i ed       ed       d! ed      d ed       d"gZ( G d# d$      Z) G d% d&e)      Z*ejB                  jW                  d'      d(        Z,d) Z-y)*    N)futures)Path)AnyCallable)ZipFile)path)Requirement)SetuptoolsDeprecationWarning   )DALSz __import__('setuptools').setup()TIMEOUT_BACKEND_TEST180__pypy__win32z_The combination of PyPy + Windows + pytest-xdist + ProcessPoolExecutor is flaky and problematic)reasonc                       e Zd ZddZy)BuildBackendBaseNc                 6    || _         |xs i | _        || _        y )N)cwdenvbackend_name)selfr   r   r   s       b/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/setuptools/tests/test_build_meta.py__init__zBuildBackendBase.__init__&   s    9"(    ).Nsetuptools.build_meta)__name__
__module____qualname__r    r   r   r   r   %   s    )r   r   c                   B     e Zd ZdZ fdZdededef   fdZd Z	 xZ
S )BuildBackendzPEP 517 Build Backendc                 Z    t        |   |i | t        j                  d      | _        y )Nr   )max_workers)superr   r   ProcessPoolExecutorpool)r   argskwargs	__class__s      r   r   zBuildBackend.__init__/   s'    $)&)//A>	r   namereturn.c                       fd}|S )<Handles arbitrary function invocations on the build backend.c                     t         j                  j                  j                        }t	        |j
                  j                        }d }	 j                  j                  t         j                        j                  t              } j                  j                  |g| i |j                  t              S # t        j                  $ rM j                  j                  d       j                  |       t!        j"                  dt         d       Y y t        j$                  j&                  t(        t*        f$ r t,        rt!        j"                  d        w xY w)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pidr,   r   s        r   methodz(BuildBackend.__getattr__.<locals>.method6   s   77??488,D'dhh8I8IJFC
ii&&ryy188A'tyy''BtBrBII'RR'' V		""".

3GyPSTUOO55{GL LL!VWs   A/B? ?AE"AE"r!   )r   r,   rG   s   `` r   __getattr__zBuildBackend.__getattr__3   s    	  r   c                     |y t        j                  t        t              5  t	        j
                  |t        j                  dk(  rt        j                  nt        j                         d d d        y # 1 sw Y   y xY w)Nnt)

contextlibsuppressProcessLookupErrorrA   r2   killr,   signalSIGTERMSIGKILL)r   rF   s     r   r;   zBuildBackend._killH   sV    ;  !3W= 	PGGC277d?O	P 	P 	Ps   AA33A<)r   r   r    __doc__r   strr   r   rH   r;   __classcell__r+   s   @r   r#   r#   ,   s-    ? c(: *Pr   r#   c                   $     e Zd Z fdZd Z xZS )r4   c                 v    t        |   |i | | j                  j                  d      \  | _        }| _        y )N:)r&   r   r   	partitionbackend_obj)r   r)   r*   _r+   s       r   r   zBuildBackendCaller.__init__P   s8    $)&)373D3D3N3Ns3S0	At/r   c                 >   t        j                  | j                         t         j                  j	                  | j
                         t        j                  | j                        }| j                  rt        || j                        }n|} t        ||      |i |S )r/   )r2   chdirr   environupdater   	importlibimport_moduler   rZ   getattr)r   r,   r)   rC   modbackends         r   __call__zBuildBackendCaller.__call__U   sw    



$((#%%d&7&78c4#3#34GG%ww%t2r22r   )r   r   r    r   re   rT   rU   s   @r   r4   r4   O   s    T
3r   r4   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'],
            )
            rh   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.cfgri   )rj   rh   ri   c                   0   e Zd ZdZd Z ej                  e      d        Zd Z	d Z
d Zej                  j                  dd	      d
        Zej                  j                  ddeg      d        Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z ed      d ed      dZd Z ed      ddd iid!Zd" Zd# Z d$ Z!ej                  j                  d%d&d'ig      d(        Z"ej                  j                  d)d*d+gfd,d+gfd-d+gfd.d+gfd/d+d0gfd1d+gfd2d+gfd3d4gfd5d+d0gfd6d+d0gfd7d+d0gfg      ej                  j                  d8d9d:g      d;               Z#d< Z$d= Z%d> ed?      iZ&d@ Z'd> edA      iZ(dB Z)ej                  j                  dCdD      dE        Z*y)FTestBuildMetaBackendr   c                 .    t        | j                        S )Nr   )r#   r   )r   s    r   get_build_backendz&TestBuildMetaBackend.get_build_backend   s    ):):;;r   )paramsc              #      K   t        j                  |j                  t        |             |j	                         5  | j                          d d d        y # 1 sw Y   y xY ww)N)prefix)r   buildparamrS   as_cwdro   )r   tmpdirrequests      r   build_backendz"TestBuildMetaBackend.build_backend   sH     

7==V5]]_ 	+((**	+ 	+ 	+s   ;A%A	A%A"A%c                 \    |j                         }dg}t        |      t        |      k(  sJ y Nsix)get_requires_for_build_wheelsortedr   rx   actualexpecteds       r   !test_get_requires_for_build_wheelz6TestBuildMetaBackend.test_get_requires_for_build_wheel   .    ;;=7f~!1111r   c                 \    |j                         }dg}t        |      t        |      k(  sJ y rz   )get_requires_for_build_sdistr}   r~   s       r   !test_get_requires_for_build_sdistz6TestBuildMetaBackend.test_get_requires_for_build_sdist   r   r   c                 B   t         j                  j                  d      }t        j                  |       |j	                  |      }t         j                  j                  ||      }t         j                  j                  |      sJ t         j                  j                  d      rJ t        |      5 }t        |j                               }d d d        d D        }|D cg c]  }|j                  d      r| }	}t        |	      dk(  sJ y # 1 sw Y   DxY wc c}w )Nz	pip-wheelworld.pyc              3   D   K   | ]  }|j                  d       s|  yw)z.pyN)endswith).0fs     r   	<genexpr>z8TestBuildMetaBackend.test_build_wheel.<locals>.<genexpr>  s     Iqzz%7H!Is     rh   r   )r2   r   r3   makedirsbuild_wheeljoinisfiler   setnamelistr   len)
r   rx   dist_dir
wheel_name
wheel_filezipfilewheel_contentspython_scriptsr   moduless
             r   test_build_wheelz%TestBuildMetaBackend.test_build_wheel   s    77??;/
H"..x8
WW\\(J7
ww~~j)) 77>>*--Z  	5G !1!1!34N	5
 J^I,KAJJz4J1KK7|q   	5 	5 Ls   3D"D9DD
build_type)wheelsdistc                    ddt        d      t        d      d}t        j                  |       t        j                  j	                  d|z         }| j                         }t        |d|z         } ||      }t        dd	d
      5 }|j                  d       d d d         ||      }	t        j                  j                  t        j                  j                  ||            sJ ||	k7  sJ t        t        j                  j                  ||	      d      j                           ||      }
|
|	k(  sJ t        j                  j                  t        j                  j                  ||
            dkD  sJ y # 1 sw Y   xY w)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"
                )rh   VERSIONrj   pyproject.tomlzpreexisting-build_r   wtutf-8encodingz0.0.2wbr   )r   r   rs   r2   r3   ro   rb   openwriter   r   closegetsize)r   r   
tmpdir_cwdfilesr   rx   build_methodfirst_resultversion_filesecond_resultthird_results              r   %test_build_with_existing_file_presentz:TestBuildMetaBackend.test_build_with_existing_file_present  sM   
 @ #
& 	

577??>J#>?..0}h.CD
 $H- )TG4 	(w'	( %X.ww~~bggll8\BCC},, 	RWW\\(M2D9??A#H-},,wwrww||HlCDqHHH	( 	(s   E88Fsetup_scriptNc                    t        d      t        d      dddddddd	d
id}|r||d<   | j                         }|j                         5  t        j                  |       ddg}t        j                         5  |D ]  }t        j                  d|t                |j                  d      }|j                  d      }d d d        d d d        t        j                  t        j                  j                  |d            5 }	t        |	j!                               }
d d d        t#        t        j                  j                  |d            5 }t        |j%                               }t'        |j)                  d      d      }t'        |j)                  d      d      }t'        |j)                  d      d      }d d d        
dhz
  h dk(  sJ h dk(  sJ dk(  sJ ddddddt'        t+        d            z   dt'        t+        d            z   fD ]  }|v rJ ||f        j-                         j/                  d      sJ j-                         d k(  sJ y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   ZxY w# 1 sw Y   xY w)!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srcrh   zQ'tool.setuptools.license-files' is deprecated in favor of 'project.license-files'z/`project.license` as a TOML table is deprecatedignoretempfoo-0.1.dist-info/METADATAr   &foo-0.1.dist-info/licenses/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/RECORDfoo-0.1.dist-info/top_level.txtr   r   r   z!Summary: This is a Python packagezLicense: MITzLicense-File: LICENSE.txtz+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   ro   ru   r   rs   warningscatch_warningsfilterwarningsr
   build_sdistr   tarfiler   r2   r   r   getnamesr   r   rS   readr	   stripr   )r   rv   r   r   rx   msgsmsg
sdist_pathr   tarsdist_contentsr   r   metadatalicenseepointslines                    r    test_build_with_pyproject_configz5TestBuildMetaBackend.test_build_with_pyproject_config?  s    #)+X   1>#8$6@ B "k>
~  ,E*..0]]_ 
	?JJucAD ((* ? YC++Hc;WXY*66v>
*66v>
	?
	? \\"'',,vvzBC 	1s 0N	1 RWW\\&&*=> 	W' !1!1!34N7<<(DEwOHEFG ',,'KLgVG	W !3 44 9
 
 	
0  "
 
 	
 === 0'9$K0K$L MM+RSTU	
 
	6D 8#5dH%55
	6 ~~(()?@@}}"IIIIK? ?
	? 
	?	1 	1	W 	Ws>   
.I&8AI=I&I3A+J I#	I&&I03I= J	c                    t        d      t        d      t        d      d}| j                         }|j                         5  t        j                  |       |j                  d      }|j                  d      }d d d        |dz  j                         sJ |dz  j                         sJ |dz  j                         rJ |d	z  j                         rJ |d
z  j                         rJ |dz  j                         rJ |dz  j                         rJ |dz  j                         rJ t        j                  t        j                  j                  |d            5 }t        |j                  d      j                         d      }|j                         }d|vsJ 	 d d d        t!        t        j                  j                  |d            5 }	t        |	j                  d      d      }
|	j#                         }d|vsJ 	 d d d        
fD ]  }dD ]  }||v rJ  dD ]  }||vrJ   y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   FxY w)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   ri   rh   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   ro   ru   r   rs   r   r   existsr   r   r2   r   rS   extractfiler   r   r   r   )r   rv   r   rx   r   r   r   pkg_infomembersr   r   filer   s                r   (test_static_metadata_in_pyproject_configz=TestBuildMetaBackend.test_static_metadata_in_pyproject_config  sS    #
  )
: ..0]]_ 	;JJu&226:J&226:J	;
 --557777??AA1199;;1199;;1199;;;;CCEE;;CCEE;;CCEE\\"'',,vvzBC 	4s3??+<=BBDgNHllnG$G333	4
 RWW\\&&*=> 	>'7<<(CDgNH&&(G.g===	>
 h& 	(D4 $t|#$4 (4''(	(1	; 	;	4 	4
	> 	>s%   8H0A H=2I	0H:=I	Ic                    t         j                  j                  d      }t        j                  |       |j	                  |      }t         j                  j                  t         j                  j                  ||            sJ y )Nz	pip-sdist)r2   r   r3   r   r   r   r   r   rx   r   
sdist_names       r   test_build_sdistz%TestBuildMetaBackend.test_build_sdist  sU    77??;/
H"..x8
ww~~bggll8Z@AAAr   c                    t         j                  j                  d      }t        j                  |       |j	                  |      }t         j                  j                  t         j                  j                  ||d            sJ y )Npip-dist-infoMETADATA)r2   r   r3   r    prepare_metadata_for_build_wheelr   r   )r   rx   r   	dist_infos       r   %test_prepare_metadata_for_build_wheelz:TestBuildMetaBackend.test_prepare_metadata_for_build_wheel  sW    77???3
H!BB8L	ww~~bggll8Y
KLLLr   c                     dD ]  }t        j                  |d        |j                  d      }t         j                  j	                  t         j                  j                  |d            sJ y)zy
        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)r2   r   r   r   r   r   )r   rx   pre_existingr   s       r   test_prepare_metadata_inplacez2TestBuildMetaBackend.test_prepare_metadata_inplace  sZ    

 	5L KKt4	5 "BB3G	ww~~bggll9jABBBr   c                     t         j                  j                  d      }|j                  |      }t         j                  j	                  t         j                  j                  ||            sJ y )Ndist)r2   r   r3   r   r   r   r   s       r   test_build_sdist_explicit_distz3TestBuildMetaBackend.test_build_sdist_explicit_dist0  sK     77??6*"..x8
ww~~bggll8Z@AAAr   c                    t         j                  j                  d      }t        j                  |       |j	                  |      }t         j                  j                  t         j                  j                  ||            sJ t         j                  j                  d      }t         j                  j                  |      st         j                  j                  d      }t        |dd      5 }|j                         }d d d        t        |dd      5 }|j                  j                  dd	             d d d        t        j                  |       t        j                  |       |j	                  d      }t         j                  j                  t         j                  j                  t         j                  j                  d      |            sJ y # 1 sw Y   xY w# 1 sw Y   xY w)
N	out_sdistrh   rj   rtr   r   r   zversion='0.0.0'zversion='0.0.1')r2   r   r3   r   r   r   r   r   r   r   r   replaceshutilrmtree)r   rx   sdist_into_directoryr   	setup_locfile_handlercontents          r   test_build_sdist_version_changez4TestBuildMetaBackend.test_build_sdist_version_change7  s]   !ww{;
()"../CD
ww~~bggll+?LMM
 GGOOJ/	ww~~i(4I)TG4 	*"'')G	*)TG4 	Vw/@BSTU	V 	*+
()"..{;
ww~~bggll277??;+GTUUU	* 	*	V 	Vs   0G"G%G"%G.c                 v   t        d      dt        d      d}t        j                  |       | j                         }|j	                  d      }t        j                  t        j                  j                  d|            5 }t        d |j                         D              sJ 	 d d d        y # 1 sw Y   y xY w)N
                __import__('setuptools').setup(
                    name='foo',
                    version='0.0.0',
                    py_modules=['hello']
                )r   r   )rh   ri   r   r   c              3   $   K   | ]  }d |v  
 yw)r   Nr!   r   r,   s     r   r   zNTestBuildMetaBackend.test_build_sdist_pyproject_toml_exists.<locals>.<genexpr>g  s     KD'4/K   r   r   rs   ro   r   r   r   r2   r   anyr   r   r   r   rx   
targz_pathr   s         r   &test_build_sdist_pyproject_toml_existsz;TestBuildMetaBackend.test_build_sdist_pyproject_toml_existsP  s     "
$ 	

5..0"..v6
\\"'',,vz:; 	LsKCLLNKKKK	L 	L 	L   #B//B8c                 T   t        j                  t        d          | j                         }|j	                  d      }t        j                  t        j                   j                  d|            5 }t        d |j                         D              sJ 	 d d d        y # 1 sw Y   y xY w)Nr   r   c              3   $   K   | ]  }d |v  
 ywrh   Nr!   r  s     r   r   zHTestBuildMetaBackend.test_build_sdist_setup_py_exists.<locals>.<genexpr>q  s     EdzT)Er  )r   rs   defnsro   r   r   r   r2   r   r  r   )r   r   rx   r  r   s        r    test_build_sdist_setup_py_existsz5TestBuildMetaBackend.test_build_sdist_setup_py_existsi  s     	

58..0"..v6
\\"'',,vz:; 	FsEcllnEEEE	F 	F 	Fs   1#BB'c                 v   t        d      dt        d      d}t        j                  |       | j                         }|j	                  d      }t        j                  t        j                  j                  d|            5 }t        d |j                         D              rJ 	 d d d        y # 1 sw Y   y xY w)Nz
        __import__('setuptools').setup(
            name='foo',
            version='0.0.0',
            py_modules=['hello']
        )r   z"
        exclude setup.py
        )rh   ri   r   r   c              3   $   K   | ]  }d |v  
 ywr!  r!   r  s     r   r   zSTestBuildMetaBackend.test_build_sdist_setup_py_manifest_excluded.<locals>.<genexpr>  s     I$:-Ir  r  r  s         r   +test_build_sdist_setup_py_manifest_excludedz@TestBuildMetaBackend.test_build_sdist_setup_py_manifest_excludeds  s      
" 	

5..0"..v6
\\"'',,vz:; 	JsI#,,.IIII	J 	J 	Jr  c                     t        d      dt        d      d}t        j                  |       | j                         }|j	                  d       y )Nr  r   zE
                [sdist]
                formats=zip
                rh   ri   rj   r   )r   r   rs   ro   r   )r   r   r   rx   s       r   3test_build_sdist_builds_targz_even_if_zip_indicatedzHTestBuildMetaBackend.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
            r(  c                     t        j                  | j                         | j                         }t	        j
                  t        d      5  |j                  d       d d d        y # 1 sw Y   y xY w)Nz^No module named 'hello'$matchr   )r   rs   _relative_path_import_filesro   r<   raisesImportErrorr   r   r   rx   s      r   %test_build_sdist_relative_path_importz:TestBuildMetaBackend.test_build_sdist_relative_path_import  sT    

4334..0]];.IJ 	.%%f-	. 	. 	.s   A&&A/zX
            [project]
            name = "proj"
            version = "42"
            projr   r   )r   r   c                     t        t        |      j                  d            }|sJ |D ]7  }|j                         rt	        j
                  |      j                  dkD  r7J  y)z?All files in the directory should be either links or hard linksz**/*r   N)listr   glob
is_symlinkr2   statst_nlink)r   
parent_dirr   r   s       r   _assert_link_treez&TestBuildMetaBackend._assert_link_tree  sT    T*%**623 	CD??$(>(>(BB	Cr   c                     t        j                  | j                         | j                         }t	        d      j                         rJ |j                  d       t	        d      j                         rJ y)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.
        rs   r   N)r   rs   _simple_pyproject_examplero   r   r   build_editabler0  s      r   %test_editable_without_config_settingsz:TestBuildMetaBackend.test_editable_without_config_settings  s[     	

4112..0=''))$$V,='')))r   c                 T   dddgi}t        j                  | j                         | j                         }t	        d      j                         rJ t	        d      j                          |j                  d|       |j                  d|       t	        d      j                         sJ y )Nz--build-option	build_extz	--inplacers   zbuild/proj-42-py3-none-any.whl)	r   rs   r<  ro   r   r   mkdirr   r   r   r   config_settingsrx   s       r   test_build_wheel_inplacez-TestBuildMetaBackend.test_build_wheel_inplace  s    +k;-GH

4112..0=''))W66wP!!'?;45<<>>>r   rC  zeditable-modestrictc                 R   t        j                  i | j                  di i       t        d      j	                         rJ | j                         }|j                  d|       |j                  d|d       | j                  t        t        d      j                  d                   y )N_metars   r   z__editable__.*)r   rs   r<  r   r   ro   #prepare_metadata_for_build_editabler=  r:  nextr5  rB  s       r   "test_editable_with_config_settingsz7TestBuildMetaBackend.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                    t        d      j                  |      t        d      d}t        j                  |       | j	                         }|r|j
                  }n|j                  }t        |      } |       }	|t        |	      k(  sJ y )Na  
                from setuptools import setup

                setup(
                    name="qux",
                    version="0.0.0",
                    py_modules=["hello"],
                    setup_requires={setup_literal},
                )
            )rK  rf   rg   )r   formatr   rs   ro   r|   r   r}   )
r   rK  rL  rN  r   r   rx   get_requiresr   r   s
             r   test_setup_requiresz(TestBuildMetaBackend.test_setup_requires  s    & 	 f=f1
* 	

5..0(EEL(EEL ,'6&>)))r   c                     t        d      t        d      ddd}t        j                  |       | j                         }|j	                         }|dgk(  sJ y )Nzd
                [project]
                name = "proj"
                version = "42"
            z
                __import__('setuptools').setup(
                    setup_requires=["foo"],
                    py_modules = ["hello", "world"]
                )
            z'hello'z'world')r   rh   ri   r   r   )r   r   rs   ro   r|   )r   r   r   rx   setup_requiress        r   'test_setup_requires_with_auto_discoveryz<TestBuildMetaBackend.test_setup_requires_with_auto_discovery&  si    
 #  "!#
& 	

5..0&CCE%(((r   c                    t        d      t        d      d}t        j                  |       | j                         }t        j                  j                  d      }t	        j                  |       |j                  |       y )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')
                    rg   r   )r   r   rs   ro   r2   r3   r   r   )r   r   r   rx   r   s        r    test_dont_install_setup_requiresz5TestBuildMetaBackend.test_dont_install_setup_requiresB  so    	 
* 	

5..077???3
H 	66x@r   rh   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                     t        j                  | j                         | j                         }t	        j
                  t              5  |j                  d       d d d        y # 1 sw Y   y xY wNr   )r   rs   _sys_argv_0_passthroughro   r<   r.  AssertionErrorr   r0  s      r   test_sys_argv_passthroughz.TestBuildMetaBackend.test_sys_argv_passthroughu  sQ    

4//0..0]]>* 	.%%f-	. 	. 	.s   	A$$A-a  
            import os
            assert os.path.isabs(__file__)
            __import__('setuptools').setup(
                name='foo',
                version='0.0.0',
                py_modules=['hello'],
                setup_requires=['six'],
            )
            c                     t        j                  | j                         | j                         }|j	                  d       y rY  )r   rs   _setup_py_file_abspathro   r   r0  s      r   test_setup_py_file_abspathz/TestBuildMetaBackend.test_setup_py_file_abspath  s0    

4../..0!!&)r   
build_hook)r   r   c                     ddi}t        j                  |       t        j                  d      }t	        j
                  t        |      5   t        ||      d       d d d        y # 1 sw Y   y xY w)Nrh   r   zNo distribution was found.r+  r   )r   rs   reescaper<   r.  
ValueErrorrb   )r   rx   r`  r   r   s        r   test_build_with_empty_setuppyz2TestBuildMetaBackend.test_build_with_empty_setuppy  s[    R 

5ii45]]:S1 	7.GM:.v6	7 	7 	7s   
A&&A/)+r   r   r    r   ro   r<   fixturer"  rx   r   r   r   markparametrizer   SETUP_SCRIPT_STUBr   r   r   r  r  r  r  r  r#  r&  r)  r   r-  r1  r<  r:  r>  rD  rJ  rR  rU  rW  rZ  r\  r^  r_  re  r!   r   r   rl   rl      s   *L< V^^5!+ "+
2
2
!( [[\+=>0I ?0Id [[^d4E-FGOJ HOJb=(~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   rl   c                       e Zd ZdZd Zd Zy)TestBuildMetaLegacyBackendz setuptools.build_meta:__legacy__c                     t        j                  | j                         | j                         }|j	                  d       y rY  )r   rs   r-  ro   r   r0  s      r   r1  z@TestBuildMetaLegacyBackend.test_build_sdist_relative_path_import  s0    

4334..0!!&)r   c                     t        j                  | j                         | j                         }|j	                  d       y rY  )r   rs   rZ  ro   r   r0  s      r   r\  z4TestBuildMetaLegacyBackend.test_sys_argv_passthrough  s0    

4//0..0!!&)r   N)r   r   r    r   r1  r\  r!   r   r   rk  rk    s    5L**r   rk  z/ignore::setuptools.SetuptoolsDeprecationWarningc                     | j                  |       d}|dz  j                  t        |      d       t        d      }|j	                         g k(  sJ y)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)
        rh   r   r   r   rn   N)r]   
write_textr   r#   r|   monkeypatchtmp_pathsetuppyrd   s       r   test_sys_exit_0_in_setuppyrt    sY     hG
 
&&tG}w&G(?@G//1R777r   c                     | j                  |       d}|dz  j                  |d       t        j                  t        d      5  t        d      }|j                          d d d        y # 1 sw Y   y xY w)	Nz"import sys; sys.exit('some error')rh   r   r   z
some errorr+  r   rn   )r]   ro  r<   r.  
SystemExitr#   r|   rp  s       r   test_system_exit_in_setuppyrw    sg    h2G
&&w&A	z	6 /,CD,,./ / /s   A++A4).rK   r`   r2   rb  r  rO   sysr   r   
concurrentr   pathlibr   typingr   r   r   r   r<   jaracor   packaging.requirementsr	   setuptools.warningsr
   textwrapr   ri  intgetenvr8   builtin_module_namesrB   rg  skipifplatform
pytestmarkr   r#   r4   r"  rl   rk  r   rt  rw  r!   r   r   <module>r     s     	 	   
          . < 6  ibii.6
7
00
0 [[LLG'   
) ) P#  PF3) 3, 	
 
& 

 
( 
 
. 	D
4 

 
( 

 7
Q|	~t
7 t
7n*!5 *$ MN
8 O
8/r   