HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/setuptools/tests/__pycache__/test_sdist.cpython-310.pyc
o

��hh��	@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlmZddl
mZddlZddlZddlmZmZddlmZddlmZdd	lmZdd
lmZddlmZddlm Z d
dl!m"Z"ddl#Z#ddl$m%Z%dddgddgidej&�'dd�gfgd�Z(de(�d�Z)edej&�'dd�gej&�'dd�gd�Z*e*j+e*j,Z-ej.dd��Z/dd �Z0d!d"�Z1d#d$�Z2d%d&�Z3ej4j5e3�d'd(�Z6ej4j7d)d*d(�Z8ej4j7e#j9�:d+�d,d(�Z;d-d.�Z<d/d0�Z=Gd1d2�d2�Z>d3d4�Z?Gd5d6�d6�Z@d7d8�ZAd9d:�ZBdS);zsdist tests�N��cleandoc)�Path)�mock)�Command�SetuptoolsDeprecationWarning)�metadata)�manifest_maker)�sdist)�Distribution)�	Extension)�
fail_on_ascii�)�	Filenames)�	run_setup�
sdist_testz0.0z*.txt�data�d�e.dat)�name�version�packages�package_data�
data_filesz&from setuptools import setup

setup(**z)
�sdist_test.fzf.c�f.h�r�sources�dependsc	csR�tjtj}}t��t��t_t_z
dVW||t_t_dS||t_t_w�N)�sys�stdout�stderr�io�StringIO)�
old_stdout�
old_stderr�r'�F/usr/local/lib/python3.10/dist-packages/setuptools/tests/test_sdist.py�quiet6s�"r)cCs,t|t�s|�tj�d�d�S|�tjd�S)N�ascii�/�/)�
isinstance�str�replace�os�sep�encode��pathr'r'r(�posixAs
r5cCsRt|t�rt�d|�Sz|�d�}t�d|�}|�d�}W|Sty(Y|Sw)N�NFD�utf-8)r-r.�unicodedata�	normalize�decoder2�UnicodeErrorr3r'r'r(�	decomposeIs

��r<cCs6t|d��}|��Wd�S1swYdS)N�rb)�open�read)�filename�fpr'r'r(�read_all_bytesUs$�rBcCsBztjtjd�\}}t�|�t�|�WdSty YdSw)N)�suffixT)�tempfile�mkstempr�latin_1r0�close�remove�	Exception)�descr@r'r'r(�latin1_failZs
�rKz)System does not support latin-1 filenames)�reasonz%os.environ.get('PYTEST_XDIST_WORKER')zpytest-dev/pytest-xdist#843�
setuptoolsz/the test is not supported with stdlib distutilscCst|d���|S)N�wb)r>rGr3r'r'r(�touchssrOc	Cs6z	t�||�W|Sttfyt�d�YdSw)Nzsymlink not supported in OS)r0�symlink�OSError�NotImplementedError�pytest�skip)�src�dstr'r'r(�symlink_or_skip_testxs�
�rWc@s�eZdZejdd�dd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�dd�dd�dd�d�Z
eej�de
���dd���Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zed(d)��Zed*d+��Zed,d-��Zed.d/��Zed0d1��Z eed2d3���Z!e"d4d5��Z#eed6d7���Z$d8d9d:d;d<�Z%ej�d=e%���ej�&d>�d?d@���Z'dAdB�Z(dCdD�Z)dEdF�Z*ej�+dG�dHdI��Z,dJS)K�
TestSdistTestT)�autouseccs��|d}|��|djtdd�|d}|��|d}|��dD]}t||�q$t|d�tD]}t||�q5|���|VWd�dS1sQwYdS)	N�project_root�setup.pyr7��encodingrr)z__init__.py�a.txt�b.txt�c.rstr)�mkdir�
write_text�SETUP_PYrO�EXTENSION_SOURCES�as_cwd)�self�tmpdir�test_pkg�data_folder�fnamer'r'r(�
source_dir�s �
"�zTestSdistTest.source_dircCsd|jj}tj�dd�|vsJ�tj�dd�|vsJ�tj�dd�|vs%J�tj�dd�|vs0J�dS)Nrr^r_r`rr)�filelist�filesr0r4�join)rf�cmd�manifestr'r'r(�assert_package_data_in_manifest�s
z-TestSdistTest.assert_package_data_in_manifestcCsdit�dtgi�}t|�}d|_t|�}|��t��
|��Wd�|S1s+wY|S)N�ext_modulesr[)�SETUP_ATTRS�	EXTENSIONr�script_namer
�ensure_finalizedr)�run�rf�setup_attrs�distror'r'r(�setup_with_extension�s

��z"TestSdistTest.setup_with_extensioncCsZtt�}d|_t|�}|��t��|��Wd�n1s!wY|�|�dS)z�Regression test for pull request #4: ensures that files listed in
        package_data are included in the manifest even if they're not added to
        version control.
        r[N)rrsrur
rvr)rwrq)rfrzror'r'r(�test_package_data_in_sdist�s
�z(TestSdistTest.test_package_data_in_sdistcCsvit�ddi�}|dsJ�t|�}d|_t|�}|��t��|��Wd�n1s/wY|�|�dS)zU
        Ensure package_data and include_package_data work
        together.
        �include_package_dataTrr[N)rsrrur
rvr)rwrqrxr'r'r(�3test_package_data_and_include_package_data_in_sdist�s
�zATestSdistTest.test_package_data_and_include_package_data_in_sdistcCs4|��}|�|�|jj}tD]}||vsJ�qdS)z�
        Ensure that the files listed in Extension.sources and Extension.depends
        are automatically included in the manifest.
        N)r{rqrlrmrd)rfrorpr4r'r'r(�test_extension_sources_in_sdist�s
�z-TestSdistTest.test_extension_sources_in_sdistcCsHtD]}t�|�q|��}|�|�|jj}tD]}||vs!J�qdS)z�
        Similar to test_extension_sources_in_sdist but the referenced files don't exist.
        Missing files should not be included in distribution (with no error raised).
        N)rdr0rHr{rqrlrm)rfr4rorpr'r'r(�test_missing_extension_sources�s
�z,TestSdistTest.test_missing_extension_sourcescCs�g}tD]$}tj�|�\}}|d|}t�||�ttj�|�|�|�|�q|��}|�	|�|j
j}tD]}||vs@J�q8|D]}||vsKJ�qCdS)z�
        Similar to test_extension_sources_in_sdist but the referenced files are
        instead symbolic links to project-local files. Referenced file paths
        should be included. Symlink targets themselves should NOT be included.
        z_target.N)rdr0r4�splitext�renamerW�basename�appendr{rqrlrm)rf�	symlinkedr4�base�ext�targetrorpr'r'r(� test_symlinked_extension_sources�s
�z.TestSdistTest.test_symlinked_extension_sourcescCstj�tj�dd��S)Nrr)r0r4�abspathrnr'r'r'r(�<lambda>szTestSdistTest.<lambda>cCstj�dddd�S)Nr�..r�r0r4rnr'r'r'r(r�scCstj�dd�S)Nrzthis_file_does_not_exist.hr�r'r'r'r(r�scCstttj�dd��d�S)Nr�zoutside_of_project_root.hz	symlink.h)rWrOr0r4rnr'r'r'r(r�s�)zmust be relativezcan't have `..` segmentsz
doesn't existzmust be inside the project rootrLc		s�|j|��tdg�gd�}it�d|gi�}t|�}d|_t|�}|��t��"|�t	j
��|��Wd�n1s?wYWd�n1sNwY|�|�|j
j}�|vsbJ��fdd�|jD�}t|�dkstJ�|\}||vs}J�dS)	a�
        Due to backwards compatibility reasons, `Extension.depends` should accept
        invalid/weird paths, but then ignore them when building a sdist.

        This test verifies that the source distribution is still built
        successfully with such paths, but that instead of adding these paths to
        the manifest, we emit an informational message, notifying the user that
        the invalid path won't be automatically included.
        rrrrr[Ncs0g|]\}}}|dkr|tjkr�|vr|�qS)�root)�logging�INFO)�.0�logger�level�message��invalid_pathr'r(�
<listcomp>3s
�z@TestSdistTest.test_invalid_extension_depends.<locals>.<listcomp>r)�_INVALID_PATHSrrsrrur
rvr)�at_levelr�r�rwrqrlrm�
record_tuples�len)	rfrL�caplog�	extensionryrzrorp�expected_messager'r�r(�test_invalid_extension_dependss2�
��

�	z,TestSdistTest.test_invalid_extension_dependsc	sddlm}t���G�fdd�d|�}it�ddi�}|ds"J�t|�}d|_t|�}|��d	|i|_	d	|i|j
_	|j
�d	�|ksFJ�d
}t��#t
jt|d��|��Wd�n1sbwYWd�n1sqwY���|�|�dS)
zq
        Ensure projects defining custom build_py don't break
        when creating sdists (issue #2849)
        r)�build_pycs"eZdZdZ��fdd�Z�ZS)z9TestSdistTest.test_custom_build_py.<locals>.CustomBuildPyzX
            Some projects have custom commands inheriting from `distutils`
            cs��t���Sr)�super�get_data_files�rf)�	__class__�using_custom_command_guardr'r(r�Ns
zHTestSdistTest.test_custom_build_py.<locals>.CustomBuildPy.get_data_files)�__name__�
__module__�__qualname__�__doc__r��
__classcell__r'�r�)r�r(�
CustomBuildPyIsr�r}Trr[r�zsetuptools instead of distutils)�matchN)�distutils.command.build_pyr�r�Mockrsrrur
rv�cmdclass�distribution�get_command_classr)rS�warnsrrw�
assert_calledrq)rf�OrigBuildPyr�ryrzro�msgr'r�r(�test_custom_build_py@s(	

��z"TestSdistTest.test_custom_build_pycCsdtt�}d|_t|�}|��t��|��Wd�n1s!wY|jj}d|vs0J�dS�N�foo.pyr[)	rrsrur
rvr)rwrlrm�rfrzrorpr'r'r(�test_setup_py_existsfs
�z"TestSdistTest.test_setup_py_existscCsztt�}d|_t|�}|��tj�d�rt�d�t	��|�
�Wd�n1s,wY|jj}d|vs;J�dSr�)
rrsrur
rvr0r4�existsrHr)rwrlrmr�r'r'r(�test_setup_py_missingrs

�z#TestSdistTest.test_setup_py_missingcCs�tdddd��
}|�d�Wd�n1swYtt�}d|_t|�}|��t��|��Wd�n1s=wY|j	j
}d|vsLJ�dS)N�MANIFEST.in�wr7r\zexclude setup.pyr�r[)r>�writerrsrur
rvr)rwrlrm)rf�
manifest_filerzrorpr'r'r(�test_setup_py_excluded�s�
�z$TestSdistTest.test_setup_py_excludedcCs�t|d�t|d�tt�}d|_t|�}|��t��|��Wd�n1s-wYtdd�|j	j
�}d|vsCJ|��d|vsKJ|��d|vsSJ|��dS)	z�
        Make sure default files (README.*, etc.) are added in a case-sensitive
        way to avoid problems with packages built on Windows.
        z
readme.rstz	SETUP.cfgzsetup.PYNcSs|��Sr)�lower)�xr'r'r(r��sz>TestSdistTest.test_defaults_case_sensitivity.<locals>.<lambda>r[z	setup.cfg)rOrrsrur
rvr)rw�maprlrm�rfrkrzrorpr'r'r(�test_defaults_case_sensitivity�s
�z,TestSdistTest.test_defaults_case_sensitivityc	Cs�dddddddd�}dddd�}i|�|���D]\}}t||�jjddd�t||�j|dd�q|��}|�|�d	d
�|jjD�}|D]}t	j
�|�sPJ�||vsZJ||f��qF|D]}t	j
�|�sgJ�||vsqJ||f��q]dS)NzJglobal-include LICEN[CS]E* COPYING* NOTICE* AUTHORS*
global-include *.txt
�)r�zBtest/.venv/lib/python3.9/site-packages/bar-2.dist-info/AUTHORS.rstzDsrc/.nox/py/lib/python3.12/site-packages/bar-2.dist-info/COPYING.txtzEdoc/.tox/default/lib/python3.11/site-packages/foo-4.dist-info/LICENSEz.venv-requirements.txtz.tox-coveragerc.txtz.noxy/coveragerc.txt)zA.tox/release/lib/python3.11/site-packages/foo-4.dist-info/LICENSEz@.nox/py/lib/python3.12/site-packages/bar-2.dist-info/COPYING.txtz=.venv/lib/python3.9/site-packages/bar-2.dist-info/AUTHORS.rstT)�parents�exist_okr7r\cSsh|]	}|�tjd��qS)r,)r/r0r1)r��fr'r'r(�	<setcomp>�szDTestSdistTest.test_exclude_dev_only_cache_folders.<locals>.<setcomp>)�itemsr�parentrarbr{rqrlrmr0r4r�)	rfrk�included�excluded�file�contentrorpr4r'r'r(�#test_exclude_dev_only_cache_folders�s2��
�z1TestSdistTest.test_exclude_dev_only_cache_folderscCs�tt�}d|_t|�}tj�dd�|_t�d�tj�dd�}t	|�t
��|��|j�
|�|��Wd�n1s?wYt|j�}|�d�}t|�|vsVJ�dS)Nr[�sdist_test.egg-info�SOURCES.txtru
smörbröd.py�UTF-8)rrsrur	r0r4rnrprarOr)rwrlr��write_manifestrBr:r5)rfrz�mmr@�contents�
u_contentsr'r'r(�+test_manifest_is_written_with_utf8_encoding�s

�

z9TestSdistTest.test_manifest_is_written_with_utf8_encodingcCs�tt�}d|_t|�}tj�dd�|_t�d�tj�dt	j
�}t|�t��|�
�|�d�}|jj�|�|��Wd�n1sFwYt|j�}|�d�t|�|vs]J�||jjvseJ�dS)Nr[r�r��
sdist_testr7r�)rrsrur	r0r4rnrprar�utf_8rOr)rwr:rlrmr�r�rBr5�rfrzr�r@�
u_filenamer�r'r'r(�)test_write_manifest_allows_utf8_filenames�s"


�

z7TestSdistTest.test_write_manifest_allows_utf8_filenamescCs�tt�}d|_t|�}tj�dd�|_t�d�tj�dt	j
�}t��|��|�
dd�}|j�|�|��Wd�n1sBwYt|j�}|�
d�t|�|vsYJ�||jjvsaJ�dS)	a
        Files that cannot be encoded to UTF-8 (specifically, those that
        weren't originally successfully decoded and have surrogate
        escapes) should be omitted from the manifest.
        See https://bitbucket.org/tarek/distribute/issue/303 for history.
        r[r�r�r�r7�surrogateescapeNr�)rrsrur	r0r4rnrprarrFr)rwr:rlr�r�rBr5rmr�r'r'r(�,test_write_manifest_skips_non_utf8_filenamess 

�

z:TestSdistTest.test_write_manifest_skips_non_utf8_filenamescCs�tt�}d|_t|�}|��t��|��Wd�n1s!wYtj�	dt
j�}tj�	dd�|_t
|jd�}|�d|�|��t|�g|j_t��|��Wd�n1sawY|�d�}||jjvssJ�dS)Nr[r�r�r��ab�
r7)rrsrur
rvr)rwr0r4rnrr�rpr>r�rGrOrlrm�
read_manifestr:�rfrzror@rpr'r'r(�(test_manifest_is_read_with_utf8_encoding5�&
�
�
z6TestSdistTest.test_manifest_is_read_with_utf8_encodingcCs�tt�}d|_t|�}|��t��|��Wd�n1s!wYtj�	dt
j�}tj�	dd�|_t
|jd�}|�d|�|��t|�g|j_t��|��Wd�n1sawY|�d�}||jjvssJ�dS)Nr[r�r�r�r�r��latin-1)rrsrur
rvr)rwr0r4rnrrFrpr>r�rGrOrlrmr�r:r�r'r'r(�+test_read_manifest_skips_non_utf8_filenamesTr�z9TestSdistTest.test_read_manifest_skips_non_utf8_filenamescCs�t|�t��}d|_t|�}|��tj�dt	j
�}t|�t��|�
�Wd�n1s0wYtjdkr>t|�}t��}tjdkri|dkrZ|�d�}||jjvsXJ�dS|�d�}||jjvsgJ�dS|�d�}||jjvsvJ�dS)Nr[r��darwin�win32�cp1252�mbcsr7)r�make_stringsrsrur
rvr0r4rnrr�rOr)rwr �platformr<�getfilesystemencodingr:rlrm�rfrzror@�fs_encr'r'r(�%test_sdist_with_utf8_encoded_filenamess(
�




z3TestSdistTest.test_sdist_with_utf8_encoded_filenamecsBt|t�r�fdd�|��D�St|t�rtt�j|��St|�S)Ncsi|]
\}}|��|��qSr')r�)r��key�value��clsr'r(�
<dictcomp>�sz.TestSdistTest.make_strings.<locals>.<dictcomp>)r-�dictr��listr�r�r.)r��itemr'r�r(r��s


zTestSdistTest.make_stringscCs�t|�t��}d|_t|�}|��tj�dt	j
�}t|�tj�|�s&J�t
��|��Wd�n1s8wYtjdkr[t��}|dkrLd}|�|�}||jjvsYJ�dS|�d�}||jjvshJ�dS)Nr[r�r�r�r�)rr�rsrur
rvr0r4rnrrFrO�isfiler)rwr r�r�r:rlrmr�r'r'r(�'test_sdist_with_latin1_encoded_filename�s$
�


z5TestSdistTest.test_sdist_with_latin1_encoded_filenamez�
            [metadata]
            name = testing
            version = file: src/VERSION.txt
            license_files = DOWHATYOUWANT
            long_description = file: README.rst, USAGE.rst
            a

            [project]
            name = "testing"
            readme = "USAGE.rst"
            license-files = ["DOWHATYOUWANT"]
            dynamic = ["version"]
            [tool.setuptools.dynamic]
            version = {file = ["src/VERSION.txt"]}
            a
            [project]
            name = "testing"
            readme = "USAGE.rst"
            license-files = ["DOWHATYOUWANT"]
            dynamic = ["version"]
            [tool.setuptools.dynamic]
            version = {file = "src/VERSION.txt"}
            a	
            [project]
            name = "testing"
            readme = "USAGE.rst"
            license = {file = "DOWHATYOUWANT"}
            dynamic = ["version"]
            [tool.setuptools.dynamic]
            version = {file = "src/VERSION.txt"}
            )z(setup.cfg - long_description and versionz@pyproject.toml - static readme/license files and dynamic versionz3pyproject.toml - directive with str instead of listz9pyproject.toml - deprecated license table with file entry�configz6ignore:.project.license. as a TOML table is deprecatedcCs8|�d�\}}}|j|}|d��|djddd�|djddd�|d	jddd�|d
jddd�||j|dd�tdgi�}d|_|��t|�}|��t	��|�
�Wd�n1sgwYd|jjvszd
|jjvszJ�d	|jjvs�J�d
|jjvs�J�d|jjvs�J�d|jjvs�J�dS)Nz - rUzsrc/VERSION.txtz0.42r7r\z
README.rstzhello world!z	USAGE.rst�
DOWHATYOUWANTrr[zsrc\VERSION.txtr,�\)
�	partition�_EXAMPLE_DIRECTIVESrarbrru�parse_config_filesr
rvr)rwrlrm)rfrkr��config_file�_�config_textrzror'r'r(�.test_add_files_referenced_by_config_directives�s,

�z<TestSdistTest.test_add_files_referenced_by_config_directivescCspt|d�tt�}d|_t|�}|��t��|��Wd�n1s'wY|jj	}d|vs6J�dS)zW
        Check if pyproject.toml is included in source distribution if present
        �pyproject.tomlr[N)
rOrrsrur
rvr)rwrlrmr�r'r'r(�test_pyproject_toml_in_sdists
�z*TestSdistTest.test_pyproject_toml_in_sdistcCs�t|d�tdddd��}td|d�Wd�n1swYtt�}d	|_t|�}|��t��|�	�Wd�n1sDwY|j
j}d|vsSJ�dS)
zH
        Check that pyproject.toml can excluded even if present
        r	r�r�r7r\zexclude pyproject.toml)r�Nr[)rOr>�printrrsrur
rvr)rwrlrm)rfrk�mtsrzrorpr'r'r(�test_pyproject_toml_excludeds�
�z*TestSdistTest.test_pyproject_toml_excludedcCst|d�tit�ddi��}t|�}|��t��|��Wd�n1s*wY|jj}d|vs9J�tit�ddi��}|�	d�}g|j
�d�|_
Gdd�dt�}|jj
|d�t|�}d	|_|��t��|��Wd�n1s|wY|jj}d|vs�J�dS)
N�.myfile~rur[�build)�build_customNc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
zFTestSdistTest.test_build_subcommand_source_files.<locals>.build_customcS�dSrr'r�r'r'r(�initialize_options0�zYTestSdistTest.test_build_subcommand_source_files.<locals>.build_custom.initialize_optionscSrrr'r�r'r'r(�finalize_options2rzWTestSdistTest.test_build_subcommand_source_files.<locals>.build_custom.finalize_optionscSrrr'r�r'r'r(rw4rzJTestSdistTest.test_build_subcommand_source_files.<locals>.build_custom.runcSsdgS)Nrr'r�r'r'r(�get_source_files6szWTestSdistTest.test_build_subcommand_source_files.<locals>.build_custom.get_source_filesN)r�r�r�rrrwrr'r'r'r(r/s
r)rT)rOrrsr
rvr)rwrlrm�get_command_obj�sub_commandsrr��update�use_defaults)rfrkrzrorprrr'r'r(�"test_build_subcommand_source_filess,
�


�z0TestSdistTest.test_build_subcommand_source_filesz6os.environ.get('SETUPTOOLS_USE_DISTUTILS') == 'stdlib'cCshtit�dddt�d�iid���}t|�}|��t��
|��Wd�dS1s-wYdS)zS
        Ensure if build_base is a pathlib.Path, the build still succeeds.
        r[r�
build_base)ru�optionsN)rrs�pathlibrr
rvr)rw)rfrkrzror'r'r(�test_build_base_pathlibCs�
�
"�z%TestSdistTest.test_build_base_pathlibN)-r�r�r�rS�fixturerkrqr{r|r~rr�r�r��skip_under_stdlib_distutils�mark�parametrize�keysr�r�r�r�r�r�r�r
r�r��skip_under_xdistr�r�� fail_on_latin1_encoded_filenamesr�r��classmethodr�r�r�filterwarningsrr
r
r�skipifrr'r'r'r(rX�sr


�+&(

 
#


		�%�
%rXcCs(tj�d�\}|��}t|d�sJ�dS)a�
    When _default_revctrl was removed from the `setuptools.command.sdist`
    module in 10.0, it broke some systems which keep an old install of
    setuptools (Distribute) around. Those old versions require that the
    setuptools package continue to implement that interface, so this
    function provides that interface, stubbed. See #320 for details.

    This interface must be maintained until Ubuntu 12.04 is no longer
    supported (by Setuptools).
    zg
        [setuptools.file_finders]
        svn_cvs = setuptools.command.sdist:_default_revctrl
        �__iter__N)r�EntryPoints�
_from_text�load�hasattr)�ep�resr'r'r(�test_default_revctrlSs
�r0c@sTeZdZdZedd��Zej�dd�dd��Z	edd	��Z
ej�dd
�dd��Zd
S)�TestRegressionszp
    Can be removed/changed if the project decides to change how it handles symlinks
    or external files.
    cCs&dddiitd|�d��ddd�d�S)	N�dir�file.hr��[
                    from setuptools import Extension, setup
                    setup(
                        name="myproj",
                        version="42",
                        ext_modules=[
                            Extension(
                                "hello", sources=["hello.pyx"],
                                depends=[�e]
                            )
                        ],
                    )
                    �global-include *.h�r[z	hello.pyxr���external�projectr)�tmp_path�dep_pathr'r'r(�&files_for_symlink_in_extension_dependsns�����z6TestRegressions.files_for_symlink_in_extension_dependsr<)zmyheaders/dir/file.hzmyheaders/dir/../dir/file.hcCsZ|�||�}tjj|t|�d�t|d|d�t||d�}dD]}||vs*J�q"dS)N��prefixr9zproject/myheadersr:)zmyproj-42/hello.pyxzmyproj-42/myheaders/dir/file.h)r=�jaracor4rr.rW�	run_sdist)rf�monkeypatchr;r<rm�members�expectedr'r'r(�!test_symlink_in_extension_depends�s�z1TestRegressions.test_symlink_in_extension_dependscCsJ|�d�\}}}|r||n|}dddiitdt|��d��ddd�d	�S)
Nz$tmp_path$/r2r3r�r4r5r6r7r8)rrr.)r;r<�headr�tailr'r'r(�,files_for_external_path_in_extension_depends�s�����z<TestRegressions.files_for_external_path_in_extension_depends)z$tmp_path$/external/dir/file.hz../external/dir/file.hcCsH|�||�}tjj|t|�d�t||d�}|D]}d|vs!J�qdS)Nr>r:r3)rHr@r4rr.rA)rfrBr;r<rmrCrr'r'r(�'test_external_path_in_extension_depends�s�z7TestRegressions.test_external_path_in_extension_dependsN)r�r�r�r��staticmethodr=rSr!r"rErHrIr'r'r'r(r1hs
�

�r1cCs�|�|�t��tddg�Wd�n1swYt|d�d��}t�t|���}t|�	��Wd�S1s?wYdS)z@Given a project directory, run the sdist and return its contentsr[r
Nrzz*.tar.gz)
�chdirr)r�next�glob�tarfiler>r.�set�getnames)rBr:�archive�tarr'r'r(rA�s
�
$�rAcCs^t�|��}|��}Wd�n1swYdd�|D�}t|�dks-Jd|����dS)NcSsg|]}d|vr|�qS)z.toxr')r�rr'r'r(r��sz:test_sanity_check_setuptools_own_sdist.<locals>.<listcomp>rz
not empty )rNr>rPr�)�setuptools_sdistrRrm�	tox_filesr'r'r(�&test_sanity_check_setuptools_own_sdist�s

�rU)Cr��
contextlibr#r�r0rr rNrDr8�inspectrr�unittestr�jaraco.pathr@rSrMrr�setuptools._importlibr�setuptools.command.egg_infor	�setuptools.command.sdistr
�setuptools.distr�setuptools.extensionr�setuptools.testsr
�textr�	distutils�distutils.corerr4rnrsrcrtrrrd�contextmanagerr)r5r<rBrKr!�xfailr%r(r$�__package__�
startswithr rOrWrXr0r1rArUr'r'r'r(�<module>s����

	���	W_