o
    LK&h	                  	   @   s  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ddZdejv Z ej!j"ej#dkore ddZ$G dd dZ%G dd de%Z&G d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$ d$Z)G d%d& d&e)Z*ej!+d'd(d) Z,d*d+ Z-dS ),    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                   @   s   e Zd ZdddZdS )BuildBackendBase.Nsetuptools.build_metac                 C   s   || _ |pi | _|| _d S )N)cwdenvbackend_name)selfr   r   r    r   S/var/www/html/venv/lib/python3.10/site-packages/setuptools/tests/test_build_meta.py__init__&   s   

zBuildBackendBase.__init__)r   Nr   )__name__
__module____qualname__r   r   r   r   r   r   %   s    r   c                       sB   e Zd ZdZ fddZdededef fddZd	d
 Z	  Z
S )BuildBackendzPEP 517 Build Backendc                    s$   t  j|i | tjdd| _d S )Nr
   )max_workers)superr   r   ProcessPoolExecutorpool)r   argskwargs	__class__r   r   r   /   s   zBuildBackend.__init__namereturn.c                    s    fdd}|S )<Handles arbitrary function invocations on the build backend.c               
      s   t jj}t|jj}d }zjt j	
t}jj| g| R i |
tW S  tjyM   jjdd | tdt d Y d S  tjjttfy`   tr_td  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pidr'   r   r   r   method6   s   $

z(BuildBackend.__getattr__.<locals>.methodr   )r   r'   rA   r   r@   r   __getattr__3   s   zBuildBackend.__getattr__c                 C   s\   |d u rd S t tt t|tjdkrtjntj	 W d    d S 1 s'w   Y  d S )Nnt)

contextlibsuppressProcessLookupErrorr:   r+   killr'   signalSIGTERMSIGKILL)r   r?   r   r   r   r4   H   s
    "zBuildBackend._kill)r   r   r   __doc__r   strr   r   rB   r4   __classcell__r   r   r%   r   r   ,   s
    r   c                       s$   e Zd Z fddZdd Z  ZS )r-   c                    s,   t  j|i | | jd\| _}| _d S )N:)r    r   r   	partitionbackend_obj)r   r#   r$   _r%   r   r   r   P   s   zBuildBackendCaller.__init__c                 O   sR   t | j t j| j t| j}| j	rt
|| j	}n|}t
|||i |S )r)   )r+   chdirr   environupdater   	importlibimport_moduler   rP   getattr)r   r'   r#   r<   modbackendr   r   r   __call__U   s   zBuildBackendCaller.__call__)r   r   r   r   rZ   rM   r   r   r%   r   r-   O   s    r-   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'],
            )
            r]   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.cfgr^   )r_   r]   r^   c                   @   s   e Zd ZdZdd Zejeddd Zdd Z	d	d
 Z
dd Zejdddd Zejddegdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zed)d*ed+d,Zd-d. Zed/d0d1d2iid3Zd4d5 Zd6d7 Z d8d9 Z!ejd:d;d<igd=d> Z"ejd?d@dAgfdBdAgfdCdAgfdDdAgfdEdAdFgfdGdAgfdHdAgfdIdJgfdKdAdFgfdLdAdFgfdMdAdFgfgejdNdOdPgdQdR Z#dSdT Z$dUdV Z%dWedXiZ&dYdZ Z'dWed[iZ(d\d] Z)ejd^d_d`da Z*dS )bTestBuildMetaBackendr   c                 C   s   t | jdS )Nr   )r   r   )r   r   r   r   get_build_backend   s   z&TestBuildMetaBackend.get_build_backend)paramsc                 c   sN    t j|jt|d |  |  V  W d    d S 1 s w   Y  d S )N)prefix)r   buildparamrL   as_cwdrb   )r   tmpdirrequestr   r   r   build_backend   s
   
"z"TestBuildMetaBackend.build_backendc                 C   &   |  }dg}t|t|ksJ d S Nsix)get_requires_for_build_wheelsortedr   rj   actualexpectedr   r   r   !test_get_requires_for_build_wheel      z6TestBuildMetaBackend.test_get_requires_for_build_wheelc                 C   rk   rl   )get_requires_for_build_sdistro   rp   r   r   r   !test_get_requires_for_build_sdist   rt   z6TestBuildMetaBackend.test_get_requires_for_build_sdistc           	      C   s   t jd}t | ||}t j||}t j|sJ t jdr'J t|}t|	 }W d    n1 s<w   Y  dd |D }dd |D }t
|dksWJ d S )Nz	pip-wheelworld.pyc                 s   s    | ]
}| d r|V  qdS )z.pyNendswith.0fr   r   r   	<genexpr>  s    z8TestBuildMetaBackend.test_build_wheel.<locals>.<genexpr>c                 S   s   g | ]	}| d s|qS )r]   rx   rz   r   r   r   
<listcomp>	  s    z9TestBuildMetaBackend.test_build_wheel.<locals>.<listcomp>r
   )r+   r   r,   makedirsbuild_wheeljoinisfiler   setnamelistlen)	r   rj   dist_dir
wheel_name
wheel_filezipfilewheel_contentspython_scriptsmodulesr   r   r   test_build_wheel   s   


z%TestBuildMetaBackend.test_build_wheel
build_type)wheelsdistc                 C   s  ddt dt dd}t| tjd| }|  }t|d| }||}tdd	d
d}|d W d    n1 s>w   Y  ||}	tj	tj
||sTJ ||	ksZJ ttj
||	d  ||}
|
|	kspJ tjtj
||
dksJ d S )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"
                )r]   VERSIONr_   pyproject.tomlzpreexisting-build_r   wtutf-8encodingz0.0.2wbr   )r   r   re   r+   r,   rb   rW   openwriter   r   closegetsize)r   r   
tmpdir_cwdfilesr   rj   build_methodfirst_resultversion_filesecond_resultthird_resultr   r   r   %test_build_with_existing_file_present  s0   
"z:TestBuildMetaBackend.test_build_with_existing_file_presentsetup_scriptNc                 C   s  t dt ddddddddd	d
id}|r||d< |  }| ; t| ddg}t  |D ]	}td|t q3|	d}|
d}W d    n1 sQw   Y  W d    n1 s`w   Y  ttj|d|}	t|	 }
W d    n1 sw   Y  ttj|d|&}t| }t|dd}t|dd}t|dd}W d    n1 sw   Y  |
dh h dksJ |h dksJ |dksJ ddddddttd dttd fD ]}||v sJ ||fq| dsJ | d ksJ d S )!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srcr]   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   rb   rg   r   re   warningscatch_warningsfilterwarningsr	   build_sdistr   tarfiler   r+   r   r   getnamesr   r   rL   readr   stripry   )r   rh   r   r   rj   msgsmsg
sdist_pathr   tarsdist_contentsr   r   metadatalicenseepointsliner   r   r    test_build_with_pyproject_config?  sx   ,?






z5TestBuildMetaBackend.test_build_with_pyproject_configc                 C   s  t dt dt dd}|  }|  t| |d}|d}W d    n1 s.w   Y  |d  s;J |d  sCJ |d  rKJ |d	  rSJ |d
  r[J |d  rcJ |d  rkJ |d  rsJ t	t
j|d|}t|d d}| }d|vsJ W d    n1 sw   Y  tt
j|d|}	t|	dd}
|	 }d|vsJ W d    n1 sw   Y  ||
fD ]}dD ]}||v sJ qdD ]}||vsJ qqd S )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   r^   r]   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   rb   rg   r   re   r   r   existsr   r   r+   r   rL   extractfiler   r   r   r   )r   rh   r   rj   r   r   r   pkg_infomembersr   r   filer   r   r   r   (test_static_metadata_in_pyproject_config  sR   


z=TestBuildMetaBackend.test_static_metadata_in_pyproject_configc                 C   s>   t jd}t | ||}t jt j||sJ d S )Nz	pip-sdist)r+   r   r,   r   r   r   r   r   rj   r   
sdist_namer   r   r   test_build_sdist  s   

z%TestBuildMetaBackend.test_build_sdistc                 C   s@   t jd}t | ||}t jt j||dsJ d S )Npip-dist-infoMETADATA)r+   r   r,   r    prepare_metadata_for_build_wheelr   r   )r   rj   r   	dist_infor   r   r   %test_prepare_metadata_for_build_wheel  s   

 z:TestBuildMetaBackend.test_prepare_metadata_for_build_wheelc                 C   s@   dD ]	}t j|dd q|d}t jt j|dsJ dS )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)r+   r   r   r   r   r   )r   rj   pre_existingr   r   r   r   test_prepare_metadata_inplace  s   
z2TestBuildMetaBackend.test_prepare_metadata_inplacec                 C   s4   t jd}||}t jt j||sJ d S )Ndist)r+   r   r,   r   r   r   r   r   r   r   test_build_sdist_explicit_dist0  s   
z3TestBuildMetaBackend.test_build_sdist_explicit_distc                 C   s  t jd}t | ||}t jt j||sJ t jd}t j|s/t jd}t|ddd}|	 }W d    n1 sEw   Y  t|ddd}|
|dd	 W d    n1 sew   Y  t| t | |d}t jt jt jd|sJ d S )
N	out_sdistr]   r_   rtr   r   r   zversion='0.0.0'zversion='0.0.1')r+   r   r,   r   r   r   r   r   r   r   r   replaceshutilrmtree)r   rj   sdist_into_directoryr   	setup_locfile_handlercontentr   r   r   test_build_sdist_version_change7  s"   





&z4TestBuildMetaBackend.test_build_sdist_version_changec                 C   s   t ddt dd}t| |  }|d}ttjd|}t	dd |
 D s0J W d    d S 1 s;w   Y  d S )N
                __import__('setuptools').setup(
                    name='foo',
                    version='0.0.0',
                    py_modules=['hello']
                )r   r   )r]   r^   r   r   c                 s       | ]}d |v V  qdS )r   Nr   r{   r'   r   r   r   r}   g      zNTestBuildMetaBackend.test_build_sdist_pyproject_toml_exists.<locals>.<genexpr>r   r   re   rb   r   r   r   r+   r   anyr   r   r   r   rj   
targz_pathr   r   r   r   &test_build_sdist_pyproject_toml_existsP  s   

"z;TestBuildMetaBackend.test_build_sdist_pyproject_toml_existsc                 C   st   t td  |  }|d}ttj d|}t	dd |
 D s(J W d    d S 1 s3w   Y  d S )Nr   r   c                 s   r   r]   Nr   r   r   r   r   r}   q  r  zHTestBuildMetaBackend.test_build_sdist_setup_py_exists.<locals>.<genexpr>)r   re   defnsrb   r   r   r   r+   r   r  r   )r   r   rj   r  r   r   r   r    test_build_sdist_setup_py_existsi  s   
"z5TestBuildMetaBackend.test_build_sdist_setup_py_existsc                 C   s   t ddt dd}t| |  }|d}ttjd|}t	dd |
 D r0J W d    d S 1 s;w   Y  d S )Nz
        __import__('setuptools').setup(
            name='foo',
            version='0.0.0',
            py_modules=['hello']
        )r   z"
        exclude setup.py
        )r]   r^   r   r   c                 s   r   r  r   r   r   r   r   r}     r  zSTestBuildMetaBackend.test_build_sdist_setup_py_manifest_excluded.<locals>.<genexpr>r  r  r   r   r   +test_build_sdist_setup_py_manifest_excludeds  s   

"z@TestBuildMetaBackend.test_build_sdist_setup_py_manifest_excludedc                 C   s4   t ddt dd}t| |  }|d d S )Nr   r   zE
                [sdist]
                formats=zip
                r]   r^   r_   r   )r   r   re   rb   r   )r   r   r   rj   r   r   r   3test_build_sdist_builds_targz_even_if_zip_indicated  s   
zHTestBuildMetaBackend.test_build_sdist_builds_targz_even_if_zip_indicatedz
            __import__('setuptools').setup(
                name='foo',
                version=__import__('hello').__version__,
                py_modules=['hello']
            )z__version__ = "0.0.0"z9
            [sdist]
            formats=zip
            r  c                 C   sR   t | j |  }tjtdd |d W d    d S 1 s"w   Y  d S )Nz^No module named 'hello'$matchr   )r   re   _relative_path_import_filesrb   r5   raisesImportErrorr   r   r   rj   r   r   r   %test_build_sdist_relative_path_import  s
   "z:TestBuildMetaBackend.test_build_sdist_relative_path_importzX
            [project]
            name = "proj"
            version = "42"
            projr   r   )r   r   c                 C   sD   t t|d}|sJ |D ]}| st|jdksJ qdS )z?All files in the directory should be either links or hard linksz**/*r   N)listr   glob
is_symlinkr+   statst_nlink)r   
parent_dirr   r   r   r   r   _assert_link_tree  s   z&TestBuildMetaBackend._assert_link_treec                 C   sB   t | j |  }td rJ |d td rJ dS )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.
        re   r   N)r   re   _simple_pyproject_examplerb   r   r   build_editabler  r   r   r   %test_editable_without_config_settings  s
   
z:TestBuildMetaBackend.test_editable_without_config_settingsc                 C   sh   dddgi}t | j |  }td rJ td  |d| |d| td s2J d S )Nz--build-option	build_extz	--inplacere   zbuild/proj-42-py3-none-any.whl)	r   re   r  rb   r   r   mkdirr   r   r   r   config_settingsrj   r   r   r   test_build_wheel_inplace  s   z-TestBuildMetaBackend.test_build_wheel_inplacer"  zeditable-modestrictc                 C   sf   t i | jdi i td rJ |  }|d| |d|d | t	td
d d S )N_metare   r   z__editable__.*)r   re   r  r   r   rb   #prepare_metadata_for_build_editabler  r  nextr  r!  r   r   r   "test_editable_with_config_settings  s   z7TestBuildMetaBackend.test_editable_with_config_settings)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           
      C   s`   t dj|dt dd}t| |  }|r|j}n|j}t|}| }	|t|	ks.J d S )Na  
                from setuptools import setup

                setup(
                    name="qux",
                    version="0.0.0",
                    py_modules=["hello"],
                    setup_requires={setup_literal},
                )
            )r)  r[   r\   )r   formatr   re   rb   rn   ru   ro   )
r   r)  r*  r,  r   r   rj   get_requiresrr   rq   r   r   r   test_setup_requires  s"   
z(TestBuildMetaBackend.test_setup_requiresc                 C   sB   t dt dddd}t| |  }| }|dgksJ d S )Nzd
                [project]
                name = "proj"
                version = "42"
            z
                __import__('setuptools').setup(
                    setup_requires=["foo"],
                    py_modules = ["hello", "world"]
                )
            z'hello'z'world')r   r]   r^   rw   r   )r   r   re   rb   rn   )r   r   r   rj   setup_requiresr   r   r   'test_setup_requires_with_auto_discovery&  s   
z<TestBuildMetaBackend.test_setup_requires_with_auto_discoveryc                 C   sH   t dt dd}t| |  }tjd}t| || d S )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')
                    r\   r   )r   r   re   rb   r+   r,   r   r   )r   r   r   rj   r   r   r   r    test_dont_install_setup_requiresB  s   

z5TestBuildMetaBackend.test_dont_install_setup_requiresr]   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                 C   sN   t | j |  }tt |d W d    d S 1 s w   Y  d S Nr   )r   re   _sys_argv_0_passthroughrb   r5   r  AssertionErrorr   r  r   r   r   test_sys_argv_passthroughu  s
   "z.TestBuildMetaBackend.test_sys_argv_passthrougha  
            import os
            assert os.path.isabs(__file__)
            __import__('setuptools').setup(
                name='foo',
                version='0.0.0',
                py_modules=['hello'],
                setup_requires=['six'],
            )
            c                 C   "   t | j |  }|d d S r3  )r   re   _setup_py_file_abspathrb   r   r  r   r   r   test_setup_py_file_abspath  s   z/TestBuildMetaBackend.test_setup_py_file_abspath
build_hook)r   r   c                 C   s^   ddi}t | td}tjt|d t||d W d    d S 1 s(w   Y  d S )Nr]   r   zNo distribution was found.r  r   )r   re   reescaper5   r  
ValueErrorrW   )r   rj   r:  r   r   r   r   r   test_build_with_empty_setuppy  s   

"z2TestBuildMetaBackend.test_build_with_empty_setuppy)+r   r   r   r   rb   r5   fixturer  rj   rs   rv   r   markparametrizer   SETUP_SCRIPT_STUBr   r   r   r   r   r   r   r  r	  r
  r  r   r  r  r  r  r  r#  r(  r/  r1  r2  r4  r6  r8  r9  r>  r   r   r   r   r`      s    


2
 ?







%"r`   c                   @   s    e Zd ZdZdd Zdd ZdS )TestBuildMetaLegacyBackendz setuptools.build_meta:__legacy__c                 C   r7  r3  )r   re   r  rb   r   r  r   r   r   r    s   z@TestBuildMetaLegacyBackend.test_build_sdist_relative_path_importc                 C   r7  r3  )r   re   r4  rb   r   r  r   r   r   r6    s   z4TestBuildMetaLegacyBackend.test_sys_argv_passthroughN)r   r   r   r   r  r6  r   r   r   r   rC    s    rC  z/ignore::setuptools.SetuptoolsDeprecationWarningc                 C   sB   |  | d}|d jt|dd tdd}| g ksJ dS )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)
        r]   r   r   r   ra   N)rR   
write_textr   r   rn   monkeypatchtmp_pathsetuppyrY   r   r   r   test_sys_exit_0_in_setuppy  s
   

rI  c                 C   sf   |  | d}|d j|dd tjtdd tdd}|  W d    d S 1 s,w   Y  d S )	Nz"import sys; sys.exit('some error')r]   r   r   z
some errorr  r   ra   )rR   rD  r5   r  
SystemExitr   rn   rE  r   r   r   test_system_exit_in_setuppy  s   


"rK  ).rD   rU   r+   r;  r   rH   sysr   r   
concurrentr   pathlibr   typingr   r   r   r   r5   jaracor   packaging.requirementsr   setuptools.warningsr	   textwrapr   rB  intgetenvr1   builtin_module_namesr;   r@  skipifplatform
pytestmarkr   r   r-   r  r`   rC  r   rI  rK  r   r   r   r   <module>   s    
#
     <

