��Qc@s3dZddlZddlZddlZddlZddlmZmZddlm Z ddl
mZddlmZ
ddlmZddl
mZddlmZdd lmZdd
lmZddlmZd�Zd
ejejejfd��YZd�Zedkr/ee��ndS(s$Tests for distutils.command.install.i�N(tcaptured_stdouttrun_unittest(t sysconfig(tinstall(t build_ext(tINSTALL_SCHEMES(tDistribution(tDistutilsOptionError(t Extension(tsupportcCs?tjdkr.tjjd�r.|d7}n|tjd�S(Ntnts_d.exet_dtSO(tostnametsyst
executabletendswithRtget_config_var(tmodname((s2/sys/lib/python2.7/distutils/tests/test_install.pyt_make_ext_names!
tInstallTestCasecBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(csn�j�}tjj|d�}tidd6�}tjj|d�|_tjd|dtjj|d��|jd<t |�}||_
|j��j|j
|��j|j|��fd �}tjj|dd
�}||j|�||j|�||j|�||jtjj|dd
d��||jtjj|d��||j|�dS(
NtinstallationtfoopkgRssetup.pyt
build_baset build_libtlibtbuildcs8tjj|�}tjj|�}�j||�dS(N(R
tpathtnormpathtassertEqual(tgottexpected(tself(s2/sys/lib/python2.7/distutils/tests/test_install.pyt
check_path6stpythontincludetbin(tmkdtempR
RtjoinRtscript_nameR tDummyCommandtcommand_objRthometensure_finalizedRtinstall_basetinstall_platbasetinstall_libtinstall_platlibtinstall_purelibtinstall_headerstinstall_scriptstinstall_data(R!tbuilddirtdestinationtdisttcmdR"tlibdir((R!s2/sys/lib/python2.7/distutils/tests/test_install.pyttest_home_installation_scheme s*
c
stjdkrdStj�_tj�_�j��_t j
j�jd��_t j
j�jd��_
�jt_�j
t_�jt_�j
t_�fd�}t j
j�_|t j
_�fd�}�j|�xdD]}�j|t�q�tid d
6�}t|�}g|jD]\}}}|^q0} �jd| �d|_�jt j
j�j���jt j
j�j
��|j��jt j
j�j���jt j
j�j
���jd
|j��jd|j�dS(Ns2.6tBtScs�jS(N(ttmpdir(R(R!(s2/sys/lib/python2.7/distutils/tests/test_install.pyt_expanduserTscsC�jt_�jt_�jt_�jt_�jtj_ dS(N(
t
old_user_basetsitet USER_BASEt
old_user_sitet USER_SITEtinstall_modulet
old_expandR
Rt
expanduser((R!(s2/sys/lib/python2.7/distutils/tests/test_install.pytcleanupYs
tnt_usert unix_usertos2_hometxxRtuserituserbasetusersite(snt_userRIsos2_home(RtversionR@RAR?RCRBR&R=R
RR't user_baset user_siteRDRFREt
addCleanuptassertInRRRtuser_optionsRLtassertFalsetexistsR,t
assertTruetconfig_vars(
R!R>RGtkeyR7R8Rtshorttlabletoptions((R!s2/sys/lib/python2.7/distutils/tests/test_install.pyttest_user_siteDs>
"
cCs4tidd6dd6�}t|�}|j�|j|jddg�|j|jd�|j|jd�dg|_|j�|j|jdg�|j|jd�|j|jd�d|_|_|j�|j|jd�|j|jd�|j|jd�d|_|jt |j�dS( NRKRs path,dirst
extra_pathRtdirstspath,dirs,again(
RRthandle_extra_pathRR^t
extra_dirst path_filetNonetassertRaisesR(R!R7R8((s2/sys/lib/python2.7/distutils/tests/test_install.pyttest_handle_extra_path~s$
cCs�tidd6�}t|�}d|_d|_|jt|j�d|_d|_|jt|j�d|_d|_ |jt|j�dS(NRKRtprefixtbaseR+RL(
RRRgR-ReRtfinalize_optionsRdR+RL(R!R7R8((s2/sys/lib/python2.7/distutils/tests/test_install.pyttest_finalize_options�s c
Cs4|j�}|jddgddg�\}}tj|�|jdd�|jdd�t|�}||jd<||_tjj |d �|_
|j�|j�t
|j
�}z|j�}Wd|j�Xg|j�D]}tjj|�^q�dd
ddtjd g} |j|| �dS(
Nt
py_modulesthellotscriptstsayhishello.pysdef main(): print 'o hai'sfrom hello import main; main()Rtfilelists hello.pycsUNKNOWN-0.0.0-py%s.%s.egg-infoi(R&tcreate_distR
tchdirt
write_fileRR*trootRR'trecordR,truntopentreadtcloset
splitlinestbasenameRtversion_infoR(
R!tinstall_dirtproject_dirR7R8tftcontenttlinetfoundR ((s2/sys/lib/python2.7/distutils/tests/test_install.pyttest_record�s(
+ cCsT|j�}|jdtddg�g�\}}tj|�tj|�t|�}tj|�|j �t
|�}||jd<||jd<||_tj
j|d�|_|j �|j�t|j�}z|j�}Wd|j�Xg|j�D]}tj
j|�^q} td�dtjd g}
|j| |
�dS( Ntext_modulesRKs
xxmodule.cRRRosUNKNOWN-0.0.0-py%s.%s.egg-infoi(R&RpRR
RqR tcopy_xxmodule_cRtfixup_build_extR,RR*RsRR'RtRuRvRwRxRyRzRRR{R(R!R|R}R7tbuildextcmdR8R~RR�R�R ((s2/sys/lib/python2.7/distutils/tests/test_install.pyttest_record_extensions�s.
+ cCsct|j�}tt_zt��|j�WdQXWdtt_X|jt|j�|k�dS(N( tlentlogstTrueRDtDEBUGRR�tFalseRW(R!told_logs_len((s2/sys/lib/python2.7/distutils/tests/test_install.pyttest_debug_mode�s
( t__name__t
__module__R:R]RfRjR�R�R�(((s2/sys/lib/python2.7/distutils/tests/test_install.pyRs $ : cCs
tjt�S(N(tunittestt makeSuiteR(((s2/sys/lib/python2.7/distutils/tests/test_install.pyt
test_suite�st__main__( t__doc__R
RR�R@ttest.test_supportRRt distutilsRtdistutils.command.installRtdistutils.commandRDtdistutils.command.build_extRRtdistutils.coreRtdistutils.errorsRtdistutils.extensionRtdistutils.testsR RtTempdirManagertLoggingSilencertTestCaseRR�R�(((s2/sys/lib/python2.7/distutils/tests/test_install.pyt<module>s* �
|