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_build_py.cpython-310.pyc
o

��hj7�@s@ddlZddlZddlZddlZddlmZddlmZddlZ	ddl
Z
ddlmZddl
mZddlmZdd	�Zd
d�Zdd
�Ze
jjddedd�dd��Zed�dddddd�d�ed�d�Zdd�Ze
j�d�dd��Zed�d ddddd!�d"did#�iddd$�ed%�d&�Zd'd(�ZGd)d*�d*�Zd0d,d-�Zd.d/�Z dS)1�N)�Path)�Mock)�SetuptoolsDeprecationWarning)�Distribution�)�DALScCs<ttddgdgddgid��}t�d�|��|��dS)z�
    Directories matching the glob in package_data should
    not be included in the package data.

    Regression test for #261.
    �setup.py�build_py�zpath/*��script_name�script_args�packages�package_datazpath/subpathN)r�dict�os�makedirs�parse_command_line�run_commands��
tmpdir_cwd�dist�r�I/usr/local/lib/python3.10/dist-packages/setuptools/tests/test_build_py.py�%test_directories_in_package_data_globs��
rcCsdttddgdgddgid��}t�d�tdd���|��|��t�	t�d	�j
�s0Jd
��dS)zt
    Files matching recursive globs (**) in package_data should
    be included in the package data.

    #1806
    rr	r
zpath/**/datarzpath/subpath/subsubpathzpath/subpath/subsubpath/data�wbz&build/lib/path/subpath/subsubpath/datazFile is not includedN)rrrr�open�closerr�stat�S_ISREG�st_moderrrr�#test_recursive_in_package_data_glob%s��
�r!cCs~ttddgdgddgid��}t�d�tdd���tdd���t�dtj�t�dtj�|�	�|�
�t�d	�d
S)z�
    Ensure read-only flag is not preserved in copy
    for package modules and package data, as that
    causes problems with deleting read-only files on
    Windows.

    #1451
    rr	�pkgzdata.datr�pkg/__init__.pyrzpkg/data.dat�buildN)
rrrrrr�chmodr�S_IREADrr�shutil�rmtreerrrr�test_read_only?s 	��
r)zplatform.system() == "Windows"z-On Windows, files do not have executable bitsT)�reason�raises�strictcCs~ttddgdgddgid��}t�d�tdd���tdd���t�dd	�|��|��t�	d
�j
t	j@s=Jd��dS)
zv
    Ensure executable bit is preserved in copy for
    package data, as users rely on it for scripts.

    #2041
    rr	r"zrun-merr#rz
pkg/run-mei�zbuild/lib/pkg/run-mezScript is not executableN)rrrrrrr%rrrr �S_IEXECrrrr�test_executable_dataZs"
��
�r.z�
        [metadata]
        name = mypkg
        version = 42

        [options]
        include_package_data = True
        packages = find:

        [options.packages.find]
        exclude = *.tests*
        r
)�__init__.pyz
test_mypkg.pyz
test_file.txt)r/�resource_file.txt�testsz�
        global-include *.py *.txt
        global-exclude *.py[cod]
        prune dist
        prune build
        prune *.egg-info
        )z	setup.cfg�mypkg�MANIFEST.inc	Cstj�t�tddi�}|��|�d�}d}tjt	|d��t
�d�dkr.tj
dd	d
d�|��|��Wd�n1s@wYt|�d�j�}|d��sUJ�|d
��s]J�dD]}t�t��||��roJ�Wd�n1sywYq_t�d�dS)Nr�	%PEP 517%r	z9Python recognizes 'mypkg\.tests' as an importable package)�match�SETUPTOOLS_USE_DISTUTILS�stdlib�ignorez!'encoding' argument not specifiedzdistutils.text_file)�module�mypkg/__init__.pyzmypkg/resource_file.txt)zmypkg/tests/__init__.pyzmypkg/tests/test_mypkg.pyzmypkg/tests/test_file.txtzmypkg/testsz#3260)�jaraco�pathr$�EXAMPLE_WITH_MANIFESTr�parse_config_files�get_command_obj�pytest�warnsrr�getenv�warnings�filterwarnings�finalize_options�runr�	build_lib�existsr+�AssertionError�xfail)rrr	�msg�	build_dir�frrr�test_excluded_subpackages�s0
�
���rNz/ignore::setuptools.SetuptoolsDeprecationWarningc	CsFtj�t�tddi�}|��|jsJ�|�d�}|�d�t	t
|j��d��}|�
�s/J�|�d�}|��|�d�}t|jd�}|�|d|�|j�dd	�|�|�d	|_|��|��|��|j�dd	�|�|�||_|��|��|js�J�td
d�|���}|s�J�tt
|jd���tj d
�}||vs�J�d	S)zwWhen provided with the ``existing_egg_info_dir`` attribute, build_py should not
    attempt to run egg_info again.
    rr4�egg_infoz
*.egg-infor	)�side_effectrF�
data_filesNcSs|�tjd�S)N�/��replacer�sep)�xrrr�<lambda>�sz(test_existing_egg_info.<locals>.<lambda>r:rR)!r;r<r$r=rr>�include_package_datar?�run_command�nextr�egg_base�glob�is_dirrErrF�setattr�__dict__�pop�reinitialize_command�existing_egg_info_dir�
assert_called�
reset_mock�assert_not_calledrQ�map�get_outputs�strrGrTrrU)	r�monkeypatchrrO�egg_info_dirr	�egg_info_run�outputs�examplerrr�test_existing_egg_info�s:







rna;
        [project]
        name = "mypkg"
        version = "42"

        [tool.setuptools]
        packages = ["mypkg", "mypkg.sub1", "mypkg.sub2", "mypkg.sub2.nested"]

        [tool.setuptools.package-dir]
        "" = "src"
        "mypkg.sub2" = "src/mypkg/_sub2"
        "mypkg.sub2.nested" = "other"
        r2)r/zmod1.pyzmod2.py)r/r0�sub1�_sub2)r/zmod3.pyzL
        global-include *.py *.txt
        global-exclude *.py[cod]
        )�pyproject.toml�src�otherr3cCs
tj�t�tddi�}|��|�d�}d|_|��|j	�
tjd�}dd�|�
�D�}||�d�|�d	�|�d
�|�d�|�d�|�d
�|�d�hksOJ�dd�|����D�}||�d�d|�d	�d|�d
�d|�d�d|�d�d|�d
�d|�d�diks�J�dS)Nrz%test%r	TrRcSsh|]	}|�tjd��qS�rRrS��.0rVrrr�	<setcomp>8sz#test_get_outputs.<locals>.<setcomp>z/mypkg/__init__.pyz/mypkg/resource_file.txtz/mypkg/sub1/__init__.pyz/mypkg/sub1/mod1.pyz/mypkg/sub2/mod2.pyz/mypkg/sub2/nested/__init__.pyz/mypkg/sub2/nested/mod3.pycSs*i|]\}}|�tjd�|�tjd��qSrtrS)rv�k�vrrr�
<dictcomp>Bs��z$test_get_outputs.<locals>.<dictcomp>zsrc/mypkg/__init__.pyzsrc/mypkg/resource_file.txtzsrc/mypkg/sub1/__init__.pyzsrc/mypkg/sub1/mod1.pyzsrc/mypkg/_sub2/mod2.pyzother/__init__.pyz
other/mod3.py)r;r<r$�EXAMPLE_ARBITRARY_MAPPINGrr>r?�
editable_mode�ensure_finalizedrGrTrrUrg�get_output_mapping�items)rrr	rGrl�mappingrrr�test_get_outputs/s:

�	
�






�r�c	@s�eZdZed�ed�ed�d�Zddddd�idd	hd
�ddddd�iid
dhd
�dddiddd�ihd�d
�d�Zej�ddej	dejj
dd�d�g�ej�de���dd���Zej�ddg�ej�de���dd���Z
dd �Zd!S)"�TestTypeInfoFileszV
            [project]
            name = "foo"
            version = "1"
            z�
            [project]
            name = "foo"
            version = "1"

            [tool.setuptools]
            include-package-data = false
            z�
            [project]
            name = "foo"
            version = "1"

            [tool.setuptools]
            include-package-data = false

            [tool.setuptools.exclude-package-data]
            "*" = ["py.typed", "*.pyi"]
            )�default_pyproject�dont_include_package_data�exclude_type_info�foor
)�bar.pyi�py.typedr/zfoo/bar.pyi�foo/py.typed)�directory_structure�expected_type_files�bar)r�zmod.pyizfoo/bar/mod.pyizfoo/bar/py.typedzfoo.pyi)�	namespace�__init__.pyir�>�foo/__init__.pyi�foo/namespace/foo.pyir�)�simple_namespace�nested_inside_namespace�namespace_nested_inside_regular�	pyprojectr�r�zpypa/setuptools#4350)r*)�marksrmcCsXi|j|d�d|j|i�}|j|d}tj�|�t�}t|�}||ks*J�dS�Nr�rqr�)�EXAMPLES�
PYPROJECTSr;r<r$�get_finalized_build_pyrg��selfrr�rm�	structurer�r	rlrrr�#test_type_files_included_by_default�s�
�z5TestTypeInfoFiles.test_type_files_included_by_defaultr�cCsZi|j|d�d|j|i�}|j|d}tj�|�t�}t|�}|�|�s+J�dSr�)r�r�r;r<r$r�rg�
isdisjointr�rrr�test_type_files_can_be_excluded�s�
�z1TestTypeInfoFiles.test_type_files_can_be_excludedcCsFtd�ddd�d�}ddh}tj�|�t�}t|�}||ks!J�dS)Nzl
                [project]
                name = "foo-stubs"
                version = "1"
                r
)r�r�)rqz	foo-stubszfoo-stubs/__init__.pyizfoo-stubs/bar.pyi)rr;r<r$r�rg)r�rr�r�r	rlrrr�test_stub_only_package�s��
z(TestTypeInfoFiles.test_stub_only_packageN)�__name__�
__module__�__qualname__rr�r�r@�mark�parametrize�paramrJ�keysr�r�r�rrrrr�Qsj��
��$�������
���	��(���
r��%build_py-test%cCs*td|i�}|��|�d�}|��|S)Nrr	)rr>r?rE)rrr	rrrr��s

r�cs t|j���fdd�|��D�S)Ncs$h|]}tj�|���tjd��qSrt)rr<�relpathrTrUru�rLrrrw�s��zget_outputs.<locals>.<setcomp>)rrGrg)r	rr�rrg�s

�rg)r�)!rr'rrC�pathlibr�
unittest.mockr�jaraco.pathr;r@�
setuptoolsr�setuptools.distr�textwraprrr!r)r�rJrIr.r=rNrDrnr{r�r�r�rgrrrr�<module>s~�
���	��$
.
7��������*"