
    ϶vg                         d 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
Z
ddlmZ e
j                            d           G d d                      Z G d d	          Zd
 Zd Zd Zd ZdS )z&Support code for distutils test cases.    N)Distribution)always_iterabledistutils_managed_tempdirc                   (    e Zd ZdZd ZddZd	dZdS )
TempdirManagerzI
    Mix-in class that handles temporary directories for test cases.
    c                 `    t          j                    }| j                            |           |S )zjCreate a temporary directory that will be cleaned up.

        Returns the path of the directory.
        )tempfilemkdtemptempdirsappend)selfds     `/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/setuptools/_distutils/tests/support.pyr
   zTempdirManager.mkdtemp   s-    
 Q    xxxc                 f    t          j        t          |                               |d           dS )zVWrites 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_filezTempdirManager.write_file   s2    
 	od++,77'7RRRRRr   fooc                     |                                  }t          j                            ||          }t          j        |           t          |          }||fS )a  Will 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_distzTempdirManager.create_dist&   sP     ,,..',,w11
"%%%}r   N)r   )r   )__name__
__module____qualname____doc__r
   r   r%    r   r   r   r      sY           S S S S     r   r   c                       e Zd ZdZd Zd ZdS )DummyCommandzAClass to store options for retrieval via set_undefined_options().c                 J    t          |                               |           d S N)varsupdate)r   kwargss     r   __init__zDummyCommand.__init__;   s"    T

&!!!!!r   c                     d S r.   r*   )r   s    r   ensure_finalizedzDummyCommand.ensure_finalized>   s    r   N)r&   r'   r(   r)   r2   r4   r*   r   r   r,   r,   8   s8        KK" " "    r   r,   c                     t          j        t                      t          j                            | d                     dS )ak  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_cr;   B   s3     K"$$bgll9l&K&KLLLLLr   c                      t           j        dk    rdnd} t          j                            t          j                            t                    |           S )N)   	   r6   zxxmodule-3.8.c)sysversion_infor   r   r   dirname__file__)source_names    r   r9   r9   Q   s=    "%"2V";";,,AQK7<<11;???r   c                    t           j        dk    r&t          j                            d          | _        dS t          j        d          rt          j        d          }|
dg| _        dS t          j	        dk    r	g | _        dS |
                    d          \  }}}d	 |                    t           j                  D             | _        dS dS )
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=c                     g | ]}||S r*   r*   ).0r   s     r   
<listcomp>z#fixup_build_ext.<locals>.<listcomp>x   s    #L#L#L!!#LA#L#L#Lr   )r   namer?   
executableendswithdebug	sysconfigget_config_varlibrary_dirsplatform	partitionsplitpathsep)cmd	runsharedrN   equalsvalues        r   fixup_build_extr]   V   s    ( 
w$N++H55					!"4	5	5 M ,[99	 #uC|x''#%   &/&9&9#&>&>#fe#L#Lu{{2:/F/F#L#L#L   M Mr   c                 Z    d t          j        | g| j                  D             | _        | S )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.
    c                 :    g | ]}t          |d g           D ]}|S )
pytestmark)getattr)rL   basemarks      r   rM   z#combine_markers.<locals>.<listcomp>   sK       D,33   	   r   )	itertoolschain	__bases__r`   )clss    r   combine_markersrh   {   s9     OSE3=99  CN
 Jr   )r)   rd   r   r   r7   r?   rR   r	   distutils.corer   pytestmore_itertoolsr   rc   usefixturesr   r,   r;   r9   r]   rh   r*   r   r   <module>rm      s<   , ,     				   



      ' ' ' ' ' '  * * * * * * 455$ $ $ $ $ $ $ 65$N       M M M@ @ @
"M "M "MJ    r   