Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/distutils/tests/support.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s/dZddlZddlZddlZddlZddlZddlZddlmZddl	Z	ddl
mZddlm
Z
mZmZmZmZddlmZd�Zdefd	��YZd
efd��YZddd
��YZdefd��YZd�Zd�Zd�ZdS(s&Support code for distutils test cases.i�N(tdeepcopy(tlog(tDEBUGtINFOtWARNtERRORtFATAL(tDistributioncs�fd�}|S(Ncs1tj��tjd��||�SWdQXdS(Ntignore(twarningstcatch_warningstsimplefilter(targstkw(tfunc(s-/sys/lib/python2.7/distutils/tests/support.pyt_capture_warningss

((RR((Rs-/sys/lib/python2.7/distutils/tests/support.pytcapture_warningsstLoggingSilencercBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCsStt|�j�tjtj�|_tjj|_	|jtj_g|_
dS(N(tsuperRtsetUpRt
set_thresholdRt	thresholdtLogt_logt_old_logtlogs(tself((s-/sys/lib/python2.7/distutils/tests/support.pyRs
cCs6tj|j�|jtj_tt|�j�dS(N(	RRRRRRRRttearDown(R((s-/sys/lib/python2.7/distutils/tests/support.pyR$scCsQ|tttttfkr4tdt|���n|jj|||f�dS(Ns%s wrong log level(	RRRRRt
ValueErrortstrRtappend(RtleveltmsgR((s-/sys/lib/python2.7/distutils/tests/support.pyR)scGsAd�}g|jD]*\}}}||kr|||�^qS(NcSst|�dkr|S||S(Ni(tlen(R R((s-/sys/lib/python2.7/distutils/tests/support.pyt_format/s(R(RtlevelsR"RR R((s-/sys/lib/python2.7/distutils/tests/support.pytget_logs.s	cCs
g|_dS(N(R(R((s-/sys/lib/python2.7/distutils/tests/support.pyt
clear_logs6s(t__name__t
__module__RRRR$R%(((s-/sys/lib/python2.7/distutils/tests/support.pyRs
	
			tTempdirManagercBsAeZdZd�Zd�Zd�Zdd�Zdd�ZRS(s}Mix-in class that handles temporary directories for test cases.

    This is intended to be used with unittest.TestCase.
    cCs/tt|�j�tj�|_g|_dS(N(RR(Rtostgetcwdtold_cwdttempdirs(R((s-/sys/lib/python2.7/distutils/tests/support.pyR@scCs_tj|j�tt|�j�x5|jrZ|jj�}tj	|tj
dk�q&WdS(Ntnttcygwin(sntscygwin(R)tchdirR+RR(RR,tpoptshutiltrmtreetname(Rtd((s-/sys/lib/python2.7/distutils/tests/support.pyREs
cCs tj�}|jj|�|S(sjCreate a temporary directory that will be cleaned up.

        Returns the path of the directory.
        (ttempfiletmkdtempR,R(RR4((s-/sys/lib/python2.7/distutils/tests/support.pyR6NstxxxcCs\t|ttf�r*tjj|�}nt|d�}z|j|�Wd|j�XdS(sWWrites a file in the given path.


        path can be a string or a sequence.
        twN(	t
isinstancetlistttupleR)tpathtjointopentwritetclose(RR<tcontenttf((s-/sys/lib/python2.7/distutils/tests/support.pyt
write_fileWstfoocKsG|j�}tjj||�}tj|�td|�}||fS(sWill 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.
        tattrs(R6R)R<R=tmkdirR(Rtpkg_nameR
ttmp_dirtpkg_dirtdist((s-/sys/lib/python2.7/distutils/tests/support.pytcreate_distes


(R&R't__doc__RRR6RCRK(((s-/sys/lib/python2.7/distutils/tests/support.pyR(:s					tDummyCommandcBs eZdZd�Zd�ZRS(sAClass to store options for retrieval via set_undefined_options().cKs1x*|j�D]\}}t|||�q
WdS(N(titemstsetattr(RtkwargsR
tval((s-/sys/lib/python2.7/distutils/tests/support.pyt__init__zscCsdS(N((R((s-/sys/lib/python2.7/distutils/tests/support.pytensure_finalized~s(R&R'RLRRRS(((s-/sys/lib/python2.7/distutils/tests/support.pyRMws	tEnvironGuardcBseZd�Zd�ZRS(cCs)tt|�j�ttj�|_dS(N(RRTRRR)tenvirontold_environ(R((s-/sys/lib/python2.7/distutils/tests/support.pyR�scCs�xE|jj�D]4\}}tjj|�|kr|tj|<qqWx3tjj�D]"}||jkrXtj|=qXqXWtt|�j�dS(N(	RVRNR)RUtgettkeysRRTR(Rtkeytvalue((s-/sys/lib/python2.7/distutils/tests/support.pyR�s(R&R'RR(((s-/sys/lib/python2.7/distutils/tests/support.pyRT�s	cCs;t�}|dkr'tjd��ntj||�dS(skHelper 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.
    s>cannot find xxmodule.c (test must run in the python build dir)N(t_get_xxmodule_pathtNonetunittesttSkipTestR1tcopy(t	directorytfilename((s-/sys/lib/python2.7/distutils/tests/support.pytcopy_xxmodule_c�s	c	Cs�tjd�}tjjtjjt�d�tjj|dd�tjj|ddddd�g}x$|D]}tjj|�rm|SqmWdS(Ntsrcdirs
xxmodule.ctModuless..(t	sysconfigtget_config_varR)R<R=tdirnamet__file__texists(Rct
candidatesR<((s-/sys/lib/python2.7/distutils/tests/support.pyR[�s$
cCs�tjdkr'tjjd�|_n�tjd�r�tjd�}|dkr`dg|_	q�tj
dkr{g|_	q�|jd�\}}}|jtj
�|_	ndS(	s4Function needed to make build_ext tests pass.

    When Python was build with --enable-shared on Unix, -L. is not good
    enough to find the libpython<blah>.so.  This is because regrtest runs
    it under a tempdir, not in the top level where the .so lives.  By the
    time we've gotten here, Python's already been chdir'd to the tempdir.

    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.
    R-s_d.exetPy_ENABLE_SHAREDt	RUNSHAREDt.tdarwint=N(R)R3tsyst
executabletendswithtdebugReRfR\tlibrary_dirstplatformt	partitiontsplittpathsep(tcmdt	runsharedR3tequalsRZ((s-/sys/lib/python2.7/distutils/tests/support.pytfixup_build_ext�s((RLR)RpR1R5R]ReR_RR	t	distutilsRt
distutils.logRRRRRtdistutils.coreRRtobjectRR(RMRTRbR[R|(((s-/sys/lib/python2.7/distutils/tests/support.pyt<module>s&(	"=		

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.