
    n&ph                         S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJ	r	  SSK
r
SSKJr  \
R                  R                  S5       " S S5      5       r " S S	5      rS
 rS rS rS rg)z&Support code for distutils test cases.    N)Distribution)always_iterabledistutils_managed_tempdirc                   2    \ rS rSrSrS rSS jrS	S jrSrg)
TempdirManager   zA
Mix-in class that handles temporary directories for test cases.
c                 f    [         R                  " 5       nU R                  R                  U5        U$ )zZCreate a temporary directory that will be cleaned up.

Returns the path of the directory.
)tempfilemkdtemptempdirsappend)selfds     V/var/www/html/venv/lib/python3.13/site-packages/setuptools/_distutils/tests/support.pyr   TempdirManager.mkdtemp   s)    
 Q    c                 X    [         R                  " [        U5      6 R                  USS9  g)zFWrites a file in the given path.

path can be a string or a sequence.
zutf-8)encodingN)pathlibPathr   
write_text)r   pathcontents      r   
write_fileTempdirManager.write_file   s%    
 	od+,77'7Rr   c                     U R                  5       n[        R                  R                  X15      n[        R                  " U5        [        US9nXE4$ )zWill generate a test environment.

This function creates:
 - a Distribution instance using keywords
 - a temporary directory with a package structure

It returns the package directory and the distribution
instance.
)attrs)r   osr   joinmkdirr   )r   pkg_namekwtmp_dirpkg_dirdists         r   create_distTempdirManager.create_dist&   s?     ,,.'',,w1
"%}r    N)xxx)foo)	__name__
__module____qualname____firstlineno____doc__r   r   r&   __static_attributes__r(   r   r   r   r      s    Sr   r   c                   $    \ rS rSrSrS rS rSrg)DummyCommand8   zAClass to store options for retrieval via set_undefined_options().c                 8    [        U 5      R                  U5        g N)varsupdate)r   kwargss     r   __init__DummyCommand.__init__;   s    T
&!r   c                     g r5   r(   )r   s    r   ensure_finalizedDummyCommand.ensure_finalized>   s    r   r(   N)r+   r,   r-   r.   r/   r9   r<   r0   r(   r   r   r2   r2   8   s    K"r   r2   c                 ~    [         R                  " [        5       [        R                  R                  U S5      5        g)aO  Helper for tests that need the xxmodule.c source file.

Example use:

    def test_compile(self):
        copy_xxmodule_c(self.tmpdir)
        self.assertIn('xxmodule.c', os.listdir(self.tmpdir))

If the source file can be found, it will be copied to *directory*.  If not,
the test will be skipped.  Errors during copy are not caught.

xxmodule.cN)shutilcopy_get_xxmodule_pathr   r   r   )	directorys    r   copy_xxmodule_crD   B   s%     KK"$bggll9l&KLr   c                      [         R                  S:  a  SOSn [        R                  R	                  [        R                  R                  [        5      U 5      $ )N)   	   r?   zxxmodule-3.8.c)sysversion_infor   r   r   dirname__file__)source_names    r   rB   rB   Q   s9    "%"2"2V";,AQK77<<1;??r   c                    [         R                  S:X  a%  [        R                  R	                  S5      U l        g[        R                  " S5      (       a  [        R                  " S5      nUc	  S/U l        g[        R                  S:X  a  / U l        gUR                  S5      u  p#nUR                  [         R                  5       Vs/ s H  oU(       d  M  UPM     snU l        ggs  snf )	a  Function needed to make build_ext tests pass.

When Python was built with --enable-shared on Unix, -L. is not enough to
find libpython<blah>.so, because regrtest runs in a tempdir, not in the
source directory where the .so lives.

When Python was built with in debug mode on Windows, build_ext commands
need their debug attribute set, and it is not done automatically for
some reason.

This function handles both of these things.  Example use:

    cmd = build_ext(dist)
    support.fixup_build_ext(cmd)
    cmd.ensure_finalized()

Unlike most other Unix platforms, Mac OS X embeds absolute paths
to shared libraries into executables, so the fixup is not needed there.
ntz_d.exePy_ENABLE_SHARED	RUNSHAREDN.darwin=)r   namerH   
executableendswithdebug	sysconfigget_config_varlibrary_dirsplatform	partitionsplitpathsep)cmd	runsharedrT   equalsvaluer   s         r   fixup_build_extrc   V   s    ( 
ww$NN++H5			!	!"4	5	5 ,,[9	 #uC||x'#% &/&9&9#&>#e/4{{2::/F#L/F!!A/F#L  
6 $Ms   
C&C&c           	          [         R                  " U /U R                  5       VVs/ s H  n[        US/ 5        H  nUPM     M     snnU l        U $ s  snnf )z
pytest will honor markers as found on the class, but when
markers are on multiple subclasses, only one appears. Use
this decorator to combine those markers.

pytestmark)	itertoolschain	__bases__getattrre   )clsbasemarks      r   combine_markersrm   {   sV     OOSE3==99DD,3D 	3 	9CN
 Js   !A)r/   rf   r   r   r@   rH   rX   r
   distutils.corer   pytestmore_itertoolsr   rl   usefixturesr   r2   rD   rB   rc   rm   r(   r   r   <module>rr      sr    ,  	   
   '  * 45$ $ 6$N M@
"MJr   