403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.109
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/distutils/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/distutils/tests/__pycache__/support.cpython-310.pyc
o

�9jZ�@s�dZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZddl
mZmZmZmZmZddlmZGdd	�d	e�ZGd
d�de�ZGdd
�d
�ZGdd�de�Zdd�Zdd�Zdd�ZdS)z&Support code for distutils test cases.�N)�deepcopy)�	os_helper)�log)�DEBUG�INFO�WARN�ERROR�FATAL)�Distributioncs@eZdZ�fdd�Z�fdd�Zdd�Zdd�Zd	d
�Z�ZS)�LoggingSilencercs6t���t�tj�|_tjj|_|jtj_g|_	dS�N)
�super�setUpr�
set_thresholdr	�	threshold�Log�_log�_old_log�logs��self��	__class__��./usr/lib/python3.10/distutils/tests/support.pyrs




zLoggingSilencer.setUpcs$t�|j�|jtj_t���dSr)rrrrrrr
�tearDownrrrrrs
zLoggingSilencer.tearDowncCsT|tttttfvrtdt|���t|t�stdt	|�j
��|j�|||f�dS)Nz%s wrong log levelzmsg should be str, not '%.200s')
rrrrr	�
ValueError�str�
isinstance�	TypeError�type�__name__r�append)r�level�msg�argsrrrr!s
�zLoggingSilencer._logcs�fdd�|jD�S)Ncs"g|]
\}}}|�vr||�qSrr)�.0r#r$r%��levelsrr�
<listcomp>*s�z,LoggingSilencer.get_logs.<locals>.<listcomp>�r)rr(rr'r�get_logs)s
�zLoggingSilencer.get_logscCs
g|_dSrr*rrrr�
clear_logs-s
zLoggingSilencer.clear_logs)	r!�
__module__�__qualname__rrrr+r,�
__classcell__rrrrrs
rcsHeZdZdZ�fdd�Z�fdd�Zdd�Zdd	d
�Zddd
�Z�Z	S)�TempdirManagerz}Mix-in class that handles temporary directories for test cases.

    This is intended to be used with unittest.TestCase.
    cst���t��|_g|_dSr)r
r�os�getcwd�old_cwd�tempdirsrrrrr7s


zTempdirManager.setUpcs>t�|j�t���|jr|j��}t�|�|jsdSdSr)	r1�chdirr3r
rr4�popr�rmtree)r�tmpdirrrrr<s


�zTempdirManager.tearDowncCst��}|j�|�|S)zjCreate a temporary directory that will be cleaned up.

        Returns the path of the directory.
        )�tempfile�mkdtempr4r")r�drrrr:EszTempdirManager.mkdtemp�xxxcCsHt|ttf�r
tjj|�}t|d�}z|�|�W|��dS|��w)zWWrites a file in the given path.


        path can be a string or a sequence.
        �wN)	r�list�tupler1�path�join�open�write�close)rr@�content�frrr�
write_fileNs
zTempdirManager.write_file�foocKs2|��}tj�||�}t�|�t|d�}||fS)aWill 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:r1r@rA�mkdirr
)r�pkg_name�kw�tmp_dir�pkg_dir�distrrr�create_dist\s



zTempdirManager.create_dist)r<)rH)
r!r-r.�__doc__rrr:rGrPr/rrrrr01s	
	r0c@s eZdZdZdd�Zdd�ZdS)�DummyCommandzAClass to store options for retrieval via set_undefined_options().cKs"|��D]
\}}t|||�qdSr)�items�setattr)r�kwargsrL�valrrr�__init__qs�zDummyCommand.__init__cCsdSrrrrrr�ensure_finalizeduszDummyCommand.ensure_finalizedN)r!r-r.rQrWrXrrrrrRnsrRcs(eZdZ�fdd�Z�fdd�Z�ZS)�EnvironGuardcstt|���ttj�|_dSr)r
rYrrr1�environ�old_environrrrrr{szEnvironGuard.setUpcsf|j��D]\}}tj�|�|kr|tj|<qttj���D]}||jvr)tj|=qtt|��	�dSr)
r[rSr1rZ�getr?�keysr
rYr)r�key�valuerrrrs
�
�zEnvironGuard.tearDown)r!r-r.rrr/rrrrrYysrYcCs(t�}|durt�d��t�||�dS)akHelper 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.
    Nz>cannot find xxmodule.c (test must run in the python build dir))�_get_xxmodule_path�unittest�SkipTest�shutil�copy)�	directory�filenamerrr�copy_xxmodule_c�s
rgc
Csft�d�}tj�tj�t�d�tj�|dd�tj�|ddddd�g}|D]}tj�|�r0|Sq$dS)N�srcdirz
xxmodule.c�Modulesz..)�	sysconfig�get_config_varr1r@rA�dirname�__file__�exists)rh�
candidatesr@rrrr`�s
�
��r`cCs�tjdkrtj�d�|_dSt�d�rBt�d�}|dur"dg|_dStj	dkr,g|_dS|�
d�\}}}d	d
�|�tj�D�|_dSdS)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�=cSsg|]}|r|�qSrr)r&r;rrrr)�sz#fixup_build_ext.<locals>.<listcomp>)
r1�name�sys�
executable�endswith�debugrjrk�library_dirs�platform�	partition�split�pathsep)�cmd�	runsharedrv�equalsr_rrr�fixup_build_ext�s




�r�)rQr1rwrcr9rarjrdr�test.supportr�	distutilsr�
distutils.logrrrrr	�distutils.corer
�objectrr0rRrYrgr`r�rrrr�<module>s&!=

Youez - 2016 - github.com/yon3zu
LinuXploit