
    vKgk7                        S SK r S SKrS SKrS SKrS SKJr  S SKJr  S SKr	S SK
r
S SKJr  S SKJr  SSKJr  S rS	 rS
 r\
R(                  R+                  SS\SS9S 5       r\" S5      SSSSSS.S.\" S5      S.rS r\
R(                  R5                  S5      S 5       r\" S5      SSSSSS.SS0S.0SSS.\" S5      S .rS! r " S" S#5      rS&S$ jrS% r g)'    N)Path)Mock)SetuptoolsDeprecationWarning)Distribution   )DALSc           	          [        [        SS/S/SS/0S95      n[        R                  " S5        UR	                  5         UR                  5         g)zv
Directories matching the glob in package_data should
not be included in the package data.

Regression test for #261.
setup.pybuild_py zpath/*script_namescript_argspackagespackage_datazpath/subpathN)r   dictosmakedirsparse_command_linerun_commands
tmpdir_cwddists     ^/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/setuptools/tests/test_build_py.py%test_directories_in_package_data_globr      sS     "#Txj)		
D KK    c           	      X   [        [        SS/S/SS/0S95      n[        R                  " S5        [	        SS5      R                  5         UR                  5         UR                  5         [        R                  " [        R                  " S	5      R                  5      (       d   S
5       eg)zd
Files matching recursive globs (**) in package_data should
be included in the package data.

#1806
r
   r   r   zpath/**/datar   zpath/subpath/subsubpathzpath/subpath/subsubpath/datawbz&build/lib/path/subpath/subsubpath/datazFile is not includedN)r   r   r   r   opencloser   r   statS_ISREGst_moder   s     r   #test_recursive_in_package_data_globr$   %   s     "#T~./		
D KK)*	'.446<< HIQQRR Rr   c           	         [        [        SS/S/SS/0S95      n[        R                  " S5        [	        SS5      R                  5         [	        SS5      R                  5         [        R                  " S[        R                  5        [        R                  " S[        R                  5        UR                  5         UR                  5         [        R                  " S	5        g
)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
r
   r   pkgzdata.datr   pkg/__init__.pyr   zpkg/data.datbuildN)r   r   r   r   r   r    chmodr!   S_IREADr   r   shutilrmtreer   s     r   test_read_onlyr-   ?   s     "#W*.		
D KK	D!'')$$&HH-HH^T\\*
MM'r   zplatform.system() == "Windows"z-On Windows, files do not have executable bitsT)reasonraisesstrictc           	         [        [        SS/S/SS/0S95      n[        R                  " S5        [	        SS5      R                  5         [	        SS5      R                  5         [        R                  " SS	5        UR                  5         UR                  5         [        R                  " S
5      R                  [        R                  -  (       d   S5       eg)zf
Ensure executable bit is preserved in copy for
package data, as users rely on it for scripts.

#2041
r
   r   r&   zrun-mer   r'   r   z
pkg/run-mei  zbuild/lib/pkg/run-mezScript is not executableN)r   r   r   r   r   r    r)   r   r   r!   r#   S_IEXECr   s     r   test_executable_datar3   Z   s     "#W(,		
D KK	D!'')t""$HH\5!77)*22T\\A "Ar   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)r4   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                 <   [         R                  R                  [        5        [	        SS05      nUR                  5         UR                  S5      nSn[        R                  " [        US9   [        R                  " S5      S:X  a  [        R                  " SS	S
S9  UR                  5         UR                  5         S S S 5        [!        UR                  S5      R"                  5      nUS-  R%                  5       (       d   eUS-  R%                  5       (       d   eS H@  n[        R&                  " [(        5         XE-  R%                  5       (       a   e S S S 5        MB     [        R*                  " S5        g ! , (       d  f       N= f! , (       d  f       M{  = f)Nr   	%PEP 517%r   z9Python recognizes 'mypkg\.tests' as an importable package)matchSETUPTOOLS_USE_DISTUTILSstdlibignorez!'encoding' argument not specifiedzdistutils.text_file)modulemypkg/__init__.pyzmypkg/resource_file.txt)zmypkg/tests/__init__.pyzmypkg/tests/test_mypkg.pyzmypkg/tests/test_file.txtzmypkg/testsz#3260)jaracopathr(   EXAMPLE_WITH_MANIFESTr   parse_config_filesget_command_objpytestwarnsr   r   getenvwarningsfilterwarningsfinalize_optionsrunr   	build_libexistsr/   AssertionErrorxfail)r   r   r   msg	build_dirfs         r   test_excluded_subpackagesrT      sO   
KK+,45D##J/H
FC	2#	>
 99/0H< ##3, 	!!#! 
?$ T))*5??@I++3355551199;;;; ]]>* "--///// +* LLG 
?	>< +*s   -AE;=F;
F	
F	z/ignore::setuptools.SetuptoolsDeprecationWarningc                    [         R                  R                  [        5        [	        SS05      nUR                  5         UR                  (       d   eUR                  S5      nUR                  S5        [        [        UR                  5      R                  S5      5      nUR                  5       (       d   eUR                  S5      nUR                  5         UR                  S5      n[        UR                   S9nUR#                  USU5        UR$                  R'                  SS	5        UR)                  U5        S	Ul        UR!                  5         UR-                  5         UR/                  5         UR$                  R'                  SS	5        UR)                  U5        XEl        UR!                  5         UR1                  5         UR2                  (       d   e[5        S
 UR7                  5       5      nU(       d   e[9        [        UR:                  S5      5      R=                  [>        R@                  S5      nX;   d   eg	)zoWhen provided with the ``existing_egg_info_dir`` attribute, build_py should not
attempt to run egg_info again.
r   r:   egg_infoz
*.egg-infor   )side_effectrL   
data_filesNc                 B    U R                  [        R                  S5      $ N/)replacer   sep)xs    r   <lambda>(test_existing_egg_info.<locals>.<lambda>   s    AIIbffc2r   r@   r[   )!rA   rB   r(   rC   r   rD   include_package_datarE   run_commandnextr   egg_baseglobis_dirrK   r   rL   setattr__dict__popreinitialize_commandexisting_egg_info_dirassert_called
reset_mockassert_not_calledrX   mapget_outputsstrrM   r\   r   r]   )	r   monkeypatchr   rV   egg_info_dirr   egg_info_runoutputsexamples	            r   test_existing_egg_inforw      s    KK+,45D$$$$##J/HZ X../44\BCL     ##J/H##J/HHLL1L%6
 ,-h' &*H"LLN  ,-h' &2"LLN""$ 2H4H4H4JKGN7$x))+>?@HHQTUGr   a;  
        [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"
        r7   )r4   zmod1.pyzmod2.py)r4   r5   sub1_sub2)r4   zmod3.pyzL
        global-include *.py *.txt
        global-exclude *.py[cod]
        )pyproject.tomlsrcotherr8   c                 0   [         R                  R                  [        5        [	        SS05      nUR                  5         UR                  S5      nSUl        UR                  5         UR                  R                  [        R                  S5      nUR                  5        Vs1 sH"  oDR                  [        R                  S5      iM$     nnUU S3U S3U S3U S	3U S
3U S3U S31:X  d   eUR                  5       R                  5        VVs0 sHD  u  pgUR                  [        R                  S5      UR                  [        R                  S5      _MF     nnnUU S3SU S3SU S3SU S	3SU S
3SU S3SU S3S0:X  d   eg s  snf s  snnf )Nr   z%test%r   Tr[   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.pyzsrc/mypkg/__init__.pyzsrc/mypkg/resource_file.txtzsrc/mypkg/sub1/__init__.pyzsrc/mypkg/sub1/mod1.pyzsrc/mypkg/_sub2/mod2.pyzother/__init__.pyzother/mod3.py)rA   rB   r(   EXAMPLE_ARBITRARY_MAPPINGr   rD   rE   editable_modeensure_finalizedrM   r\   r   r]   rp   get_output_mappingitems)	r   r   r   rM   r^   ru   kvmappings	            r   test_get_outputsr   /  s   
KK/012D##J/H!H""**26637I/7/C/C/EF/E!yy%/EGF+'(+-.+,-+()+()+34+/0    //17799DA 	
		"&&#		"&&# 669   +'(*A+-.0M+,-/K+()+C+()+D+346I+/0/    Gs   %(FA
Fc                   ,   \ rS rSr\" S5      \" S5      \" S5      S.rSSSSS.0S	S
1S.SSSSS.00SS1S.SSS0SSS.01 SkS.S.r\R                  R                  SS\R                  " S\R                  R                  SS9S9/5      \R                  R                  S\R                  5       5      S 5       5       r\R                  R                  SS/5      \R                  R                  S\R                  5       5      S 5       5       rS rSrg )!TestTypeInfoFilesiQ  zV
            [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.typedr4   zfoo/bar.pyifoo/py.typed)directory_structureexpected_type_filesbar)r   zmod.pyizfoo/bar/mod.pyizfoo/bar/py.typedzfoo.pyi)	namespace__init__.pyir   >   r   foo/__init__.pyifoo/namespace/foo.pyi)simple_namespacenested_inside_namespacenamespace_nested_inside_regular	pyprojectr   r   zpypa/setuptools#4350)r.   )marksrv   c                     0 U R                   U   S   ESU R                  U   0EnU R                   U   S   n[        R                  R	                  U5        [        5       n[        U5      nXW::  d   eg Nr   rz   r   )EXAMPLES
PYPROJECTSrA   rB   r(   get_finalized_build_pyrp   selfr   r   rv   	structurer   r   ru   s           r   #test_type_files_included_by_default5TestTypeInfoFiles.test_type_files_included_by_default  sz    
mmG$%:;
dooi8
	 #mmG45JK)$)+h'"---r   r   c                 
   0 U R                   U   S   ESU R                  U   0EnU R                   U   S   n[        R                  R	                  U5        [        5       n[        U5      nUR                  U5      (       d   eg r   )r   r   rA   rB   r(   r   rp   
isdisjointr   s           r   test_type_files_can_be_excluded1TestTypeInfoFiles.test_type_files_can_be_excluded  s    
mmG$%:;
dooi8
	 #mmG45JK)$)+h'"--g6666r   c                     [        S5      SSS.S.nSS1n[        R                  R                  U5        [	        5       n[        U5      nX5::  d   eg )Nzl
                [project]
                name = "foo-stubs"
                version = "1"
                r   )r   r   )rz   z	foo-stubszfoo-stubs/__init__.pyizfoo-stubs/bar.pyi)r   rA   rB   r(   r   rp   )r   r   r   r   r   ru   s         r   test_stub_only_package(TestTypeInfoFiles.test_stub_only_package  s^    " +-<	
	  89LM)$)+h'"---r    N)__name__
__module____qualname____firstlineno__r   r   r   rF   markparametrizeparamrP   keysr   r   r   __static_attributes__r   r   r   r   r   Q  s~   !
 &*	&
 "

%JH ! "#%$ %2>#B	
 $&#%$ %67I#J
$
 !2" %' "$$,
-&HP [[LL+kk''/E'F	
	 [[Y8
. 9	
. [[[+>*?@[[Y8
7 9 A
7.r   r   c                     [        SU 05      nUR                  5         UR                  S5      nUR                  5         U$ )Nr   r   )r   rD   rE   rK   )r   r   r   s      r   r   r     s>    45D##J/HOr   c                     [        U R                  5      nU R                  5        Vs1 sH@  n[        R                  R                  X!5      R                  [        R                  S5      iMB     sn$ s  snf rZ   )r   rM   rp   r   rB   relpathr\   r]   )r   rR   r^   s      r   rp   rp     s`    X''(I %%''A 	%--bffc:'  s   AA1)z%build_py-test%)!r   r+   r!   rI   pathlibr   unittest.mockr   jaraco.pathrA   rF   
setuptoolsr   setuptools.distr   textwrapr   r   r$   r-   r   rP   rO   r3   rC   rT   rJ   rw   r~   r   r   r   rp   r   r   r   <module>r      sU   	        3 ( (46 $:	  : 	 
 	1! H+\ MN3 O3n 	  	!#!
 2

  	C' TD. .Dr   