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

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


��Qc@s	ddlZddlZddlmZddlZddlmZmZddlmZddl	m
Z
ddlmZddl
mZmZmZddlZddlmZead	ejejejfd
��YZd�Zedkreje��ndS(
i�N(tStringIO(t	ExtensiontDistribution(t	build_ext(t	sysconfig(tsupport(tDistutilsSetupErrortCompileErrortDistutilsPlatformError(ttest_supporttBuildExtTestCasecBseZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zejejdkd�d��Zejejdkd�d��Zejejdkd�d��Zd�ZRS(cCs�tt|�j�|j�|_t|_tjj	|j�|j
tjj|j�tjdkr�ddl
}|j|_|j�|_ddlm}|j|_ndS(Ns2.6i�(R(tsuperR
tsetUptmkdtempttmp_dirtFalset
xx_createdtsystpathtappendt
addCleanuptremovetversiontsitet	USER_BASEt
old_user_basetdistutils.commandR(tselfRR((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyRs	cCs0|jrtjd�ntt|�j�dS(Ntxx(RR	tunloadRR
ttearDown(R((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyR%s	c	Cs�tj|j�t|_tjj|jd�}td|g�}t	idd6|gd6�}|j|_
t|�}tj|�|j|_
|j|_tj}tjs�t�t_nz|j�|j�Wd|t_Xtr�Staddl}x$dD]}|jt||��qW|j|jd
d�d�|j|jd
d�d�|j|j�j�d�tjr�d}|j|j |�n|jt!|j"�|j"��|jt!|j#�|j#��dS(Ns
xxmodule.cRtnametext_modulesi�terrortfootnewtrojiiii
iis/This is a template module just for instruction.(serrorsfoosnewR$($Rtcopy_xxmodule_cRtTrueRtosRtjoinRRtpackage_dirRtfixup_build_extt	build_libt
build_tempRtstdoutR	tverboseRtensure_finalizedtruntALREADY_TESTEDRt
assertTruethasattrtassertEqualR"R#tdemotNonetHAVE_DOCSTRINGSt__doc__t
isinstancetNulltStr(	Rtxx_ctxx_exttdisttcmdt
old_stdoutRtattrtdoc((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_build_ext,s>	
		


	cCs�tidd6�}t|�}tj}dt_ddlm}|jd�}d|d<z|j�Wd|t_|dkr�|d=n
||d<X|j	t
|j�dk�dS(	NRRtsunosi�(t_config_varstPy_ENABLE_SHAREDii(RRRtplatformtdistutils.sysconfigREtgetR/R6R2tlentlibrary_dirs(RR>R?toldREtold_var((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_solaris_enable_sharedVs		
	
c
Cs
tjdkrdSddl}tidd6�}t|�}g|jD]\}}}|^qH}|jd|�d|_tj	j
|jd�}tj	j
|jd�}	tj|�tj|	�|j
�|j||j�|j||j�|j|	|j�dS(	Ns2.6i�RRtuseritlibtinclude(RRRRRtuser_optionstassertInROR'RR(RtmkdirR/RKtrpathtinclude_dirs(
RRR>R?RtshorttlabeltoptionsRPtincl((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_user_siteks""	


cCs3tddg�g}tidd6|d6�}t|�}|j�tj�}|j||jk�tjdd�}|j||jk�t|�}d|_|j�|j	|jd	d
dg�t|�}dt
j|_|j�|j
d
|j�|j
d|j�t|�}dt
j|_|j�|j	|jddg�t|�}d|_|j�|j	|jddg�t|�}d|_|j�|j	|jddg�t|�}d|_|j�|j	|jg�t|�}d|_|j�|j	|jddg�dS(NR"txxxRRR t
plat_specificismy_lib, other_lib lastlibtmy_libt	other_libtlastlibsmy_lib_dir%sother_lib_dirt
my_lib_dirt
other_lib_dirsone%stwotonettwosone,twot1s1 2t2(RcRe(RdRe(RRRtfinalize_optionsRtget_python_incR2RVt	librariesR4R'tpathsepRKRSRUtdefinetundefR6t	swig_opts(RtmodulesR>R?t
py_includetplat_py_include((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_finalize_options�sJ
	


	
	
	
	
cCs�t�}t|�}|j�|jt|jd�ddg}|jt|j|�dg}|jt|j|�dg}|jt|j|�didgd6dd6dd6fg}|j|�|d	}|jt|t��|j	|j
d�|jt|d��didgd6dd6dd6ddgd
6fg}|jt|j|�ddg|d	dd
<|j|�|j	|d	jdg�|j	|d	j
dg�dS(NR"tbarsfoo-bartsfoo.bartsourcesRitsomeiReRft3tmacrosi(RrsfooRr(sfoo-barRs(sfoo.barRs(ReRfRv(ReRf(Rv(ReRf(RRRgtassertRaisesRtcheck_extensions_listR2R9RR4RiR3tundef_macrost
define_macros(RR>R?textstext((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_check_extensions_list�s0	
		


cCsbtddg�g}tidd6|d6�}t|�}|j�|j|j�dg�dS(NR"R\RRR (RRRR/R4tget_source_files(RRnR>R?((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_get_source_files�s

cCsIt�}t|�}d|_|j�|j�|j|jd�dS(Ntunix(RRtcompilerR/R0R4(RR>R?((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_compiler_option�s		

c
Cs*|j�}tjj|d�}|j|d�td|g�}tidd6|gd6�}t|�}tj	|�|j
�|jt|j
��d�tjj|jd�|_tjj|jd	�|_tjj|j��}tj�}tj|�z'd|_|j�|j
�d
}Wdtj|�X|jtjj|��|jtjj|�dtjd��tjj|�}	|j|	|�d|_d
|_|j�|j
�d
}|jtjj|��|jtjj|�dtjd��tjj|�}	|j|	|j�|jd
�}
idd6|
_|j d�}tjj!|�d
}|j||j�d|_tjj|j��}tj�}tj|�z|j d�}Wdtj|�Xtjj!|�d
}tjj!|�d}|j|d�dS(Nsfoo.csvoid initfoo(void) {};
R"RRR itbuildttemptii�tSOtbuild_pyRrRs("R
R'RR(t
write_fileRRRRR*R/R4RJtget_outputsRR+R,trealpathtgetcwdtchdirtinplaceR0R2texiststsplitextRtget_config_vartdirnameR6R�tget_finalized_commandR)tget_ext_fullpathtsplit(
RRtc_fileR}R>R?t
other_tmp_dirtold_wdtso_filetso_dirR�Rtlastdir((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_get_outputs	sb



	
		
	
cCs�tj�d}t�}t|�}d|_idd6|j_ddg|j_tj	�}tj
j|ddd|�}|jd�}|j
||�d	|_tj
j|d
�|_tj
j|d
dd|�}|jd�}|j
||�|jd�}i|_dd
g|j_|jd
�}tj
j|d
ddd|�}|j
||�d|_|jd
�}tj
j|ddd|�}|j
||�dS(NR�itsrcRstlxmls	lxml.htmltetrees
lxml.etreeittmpdirR�ttwistedstwisted.runner.portmaptrunnertportmap(Rtget_config_varsRRR�tdistributionR)tpackagesR'R�RR(R�R4R+R�(RR}R>R?tcurdirtwantedRR�((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_ext_fullpathHs4				
	c	Cs�tjj|jd�}td|g�}tidd6|gd6�}t|�}|j�d|_idd6|j	_
dd	g|j	_tj�}t
jd
�}tjj|ddd|�}|jd�}|j||�dS(Nslxml.etree.cs
lxml.etreeR�RR iR�Rss	lxml.htmlR�R�(R'RR(RRRRR/R�R�R)R�R�RR�R�R4(	Rtetree_ct	etree_extR>R?R�R}R�R((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_build_ext_inplacejs
	c
Cszddl}ddl}ddl}|jj}ztjddt�ddlm	}ddl
m}tjj
|jd�}|d|g�}tidd	6|gd
6�}||�}|j�d|_idd
6|j_ddg|j_tj�}	tjd�}
tjj
|	ddd|
�}|jd�}|j||�Wd||j_||j_||jj	_XdS(Ni�tsetuptools_build_extt
deprecated(R(Rslxml.etree.cs
lxml.etreeR�RR iR�Rss	lxml.htmlR�R�(tdistutils.coretdistutils.extensiontdistutils.command.build_extt	extensionRR	t
import_moduleR&R�Rtsetuptools_extensionR'RR(RRR/R�R�R)R�R�RR�R�R4tcoretcommand(
Rt	distutilst	saved_extR�RR�R�R>R?R�R}R�R((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_setuptools_compatys,$
	cCs�tidd6�}t|�}|j�tjd�}tjjdd�}|j|�}tjj|j	dd|�}|j
||�dS(Nt
UpdateManagerRR�tfdsend(RRR/RR�R'RR(R�R+R4(RR>R?R}text_nametext_pathR�((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_build_ext_path_with_os_sep�s
cCs�tjdkrdStidd6�}t|�}|j�tjd�}d}|j|�}tj	j
|jdd|�}|j||�dS(Ntwin32R�RR�sUpdateManager/fdsendR�(
RRGRRR/RR�R�R'RR(R+R4(RR>R?R}R�R�R�((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyt"test_build_ext_path_cross_platform�s
tdarwinstest only relevant for MacOSXcCs|jdd�dS(Ns==(t_try_compile_deployment_targetR6(R((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_deployment_target_default�scCs|jt|jdd�dS(Nt>s10.1(RxRR�(R((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyttest_deployment_target_too_low�s	cCs}tjd�}|ryg|jd�D]}t|�^q%}|dcd7<djd�|D��}|jd|�ndS(NtMACOSX_DEPLOYMENT_TARGETt.i�icss|]}t|�VqdS(N(tstr(t.0ti((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pys	<genexpr>�st<(RR�R�tintR(R�(Rt	deptargettx((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyt test_deployment_target_higher_ok�s(c	Cs�tj}|j�t_|jttd|�|dkr\tjjd�ritjd=qin
|tjd<tjj|j	d�}t
|d��}|jtj
d|��WdQXtjd�}ttt|jd���}d|}td|gd	d
|fg�}tidd6|gd6�}|j	|_t|�}|j	|_|j	|_y|j�|j�Wntk
r�|jd
�nXdS(NtenvironR�sdeptargetmodule.ctws�                #include <AvailabilityMacros.h>

                int dummy;

                #if TARGET %s MAC_OS_X_VERSION_MIN_REQUIRED
                #else
                #error "Unexpected target"
                #endif

            R�s	%02d%01d0R�textra_compile_argss-DTARGET=%sRR s*Wrong deployment target during compilation(R'R�tcopyRtsetattrR6RIRR(RtopentwritettextwraptdedentRR�ttupletmapR�R�RRR)RR+R,R/R0Rtfail(	Rtoperatorttargettorig_environtdeptarget_ctfpt
deptarget_extR>R?((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyR��s<	


	

(t__name__t
__module__RRRCRNR[RqR~R�R�R�R�R�R�R�R�tunittestt
skipUnlessRRGR�R�R�R�(((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyR
s&	
		*			?	/			?	"			
	
$$$
cCs
tjt�S(N(R�t	makeSuiteR
(((s4/sys/lib/python2.7/distutils/tests/test_build_ext.pyt
test_suite�st__main__(RR'RR�R�RRR�RR�Rtdistutils.testsRtdistutils.errorsRRRR�ttestR	RR1tTempdirManagertLoggingSilencertTestCaseR
R�R�trun_unittest(((s4/sys/lib/python2.7/distutils/tests/test_build_ext.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 [email protected].