%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/distutils/tests/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/distutils/tests/__pycache__/support.cpython-38.pyc

U

qa@sdZddlZddlZddlZddlZddlZddlZddlmZddl	Z
ddlmZddl
mZmZmZmZmZddlmZGdddeZGd	d
d
eZGdddZGd
ddeZddZddZddZdS)z&Support code for distutils test cases.N)deepcopy)log)DEBUGINFOWARNERRORFATAL)Distributioncs@eZdZfddZfddZddZddZd	d
ZZS)LoggingSilencercs6tttj|_tjj|_|jtj_g|_	dSN)
supersetUpr
set_thresholdr	thresholdLog_log_old_loglogsself	__class__3/usr/local/lib/python3.8/distutils/tests/support.pyr
s



zLoggingSilencer.setUpcs$t|j|jtj_tdSr)rrrrrrrtearDownrrrrrs
zLoggingSilencer.tearDowncCsT|tttttfkr"tdt|t|ts>tdt	|j
|j|||fdS)Nz%s wrong log levelzmsg should be str, not '%.200s')
rrrrr
ValueErrorstr
isinstance	TypeErrortype__name__rappend)rlevelmsgargsrrrr!s
zLoggingSilencer._logcsdd}fdd|jDS)NcSs||Srr)r#r$rrr_format*sz)LoggingSilencer.get_logs.<locals>._formatcs"g|]\}}}|kr||qSrr).0r"r#r$levelsrr
<listcomp>,sz,LoggingSilencer.get_logs.<locals>.<listcomp>r)rr(r%rr'rget_logs)s
zLoggingSilencer.get_logscCs
g|_dSrr*rrrr
clear_logs/szLoggingSilencer.clear_logs)	r 
__module____qualname__r
rrr+r,
__classcell__rrrrr
s

r
csHeZdZdZfddZfddZddZdd	d
Zddd
ZZ	S)TempdirManagerz}Mix-in class that handles temporary directories for test cases.

    This is intended to be used with unittest.TestCase.
    cstt|_g|_dSr)rr
osgetcwdold_cwdtempdirsrrrrr
9s

zTempdirManager.setUpcs8t|jt|jr4|j}tj	|qdSr)
r1chdirr3rrr4poptestsupportrmtree)rZtmpdirrrrr>s


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

        Returns the path of the directory.
        )tempfilemkdtempr4r!)rdrrrr;GszTempdirManager.mkdtempxxxcCsBt|ttfrtjj|}t|d}z||W5|XdS)zWWrites a file in the given path.


        path can be a string or a sequence.
        wN)	rlisttupler1pathjoinopenclosewrite)rrAZcontentfrrr
write_filePs
zTempdirManager.write_filefoocKs2|}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.
        )Zattrs)r;r1rArBmkdirr	)rZpkg_namekwZtmp_dirZpkg_dirdistrrrcreate_dist^s



zTempdirManager.create_dist)r=)rH)
r r-r.__doc__r
rr;rGrLr/rrrrr03s		
r0c@s eZdZdZddZddZdS)DummyCommandzAClass to store options for retrieval via set_undefined_options().cKs"|D]\}}t|||qdSr)itemssetattr)rkwargsrJvalrrr__init__sszDummyCommand.__init__cCsdSrrrrrrensure_finalizedwszDummyCommand.ensure_finalizedN)r r-r.rMrSrTrrrrrNpsrNcs(eZdZfddZfddZZS)EnvironGuardcstt|ttj|_dSr)rrUr
rr1environold_environrrrrr
}szEnvironGuard.setUpcsf|jD]"\}}tj||kr
|tj|<q
ttjD]}||jkr<tj|=q<tt|	dSr)
rWrOr1rVgetr@keysrrUr)rkeyvaluerrrrs

zEnvironGuard.tearDown)r r-r.r
rr/rrrrrU{srUcCs(t}|dkrtdt||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_pathunittestZSkipTestshutilcopy)Z	directoryfilenamerrrcopy_xxmodule_cs
rac
Csftd}tjtjtdtj|ddtj|dddddg}|D]}tj|rH|SqHdS)Nsrcdirz
xxmodule.cZModulesz..)	sysconfigget_config_varr1rArBdirname__file__exists)rbZ
candidatesrArrrr\s

r\cCs~tjdkrtjd|_n`tdrztd}|dkr@dg|_n:tj	dkrRg|_n(|
d\}}}d	d
|tjD|_dS)aFunction 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.exeZPy_ENABLE_SHAREDZ	RUNSHAREDN.darwin=cSsg|]}|r|qSrr)r&r<rrrr)sz#fixup_build_ext.<locals>.<listcomp>)
r1namesys
executableendswithdebugrcrdZlibrary_dirsplatform	partitionsplitpathsep)cmdZ	runsharedrlZequalsr[rrrfixup_build_exts




rv)rMr1rmr^r:r]rcr_rZtest.supportr7Z	distutilsrZ
distutils.logrrrrrZdistutils.corer	objectr
r0rNrUrar\rvrrrr<module>s$#=

Zerion Mini Shell 1.0