��Qc@sQdZddlZddlZddlZddlZddlZddlZddlmZm Z ddl
mZddlZddl
mZmZmZddlmZdefd��YZd efd
��YZdejejejejfd��YZd
ejejejfd��YZd�ZedkrMee��ndS(sTests for distutils.dist.i�N(tDistributiontfix_help_options(tCommand(tTESTFNtcaptured_stdouttrun_unittest(tsupportt test_distcBs eZdZdgZd�ZRS(s#Sample distutils extension command.ssample-option=tSs help textcCs
d|_dS(N(tNonet
sample_option(tself((s//sys/lib/python2.7/distutils/tests/test_dist.pytinitialize_optionss(ssample-option=Rs help text(t__name__t
__module__t__doc__tuser_optionsR(((s//sys/lib/python2.7/distutils/tests/test_dist.pyRs tTestDistributioncBseZdZd�ZRS(s�Distribution subclasses that avoids the default search for
configuration files.
The ._config_files attribute must be set before
.parse_config_files() is called.
cCs|jS(N(t
_config_files(R((s//sys/lib/python2.7/distutils/tests/test_dist.pytfind_config_files%s(R
RRR(((s//sys/lib/python2.7/distutils/tests/test_dist.pyRstDistributionTestCasecBs�eZd�Zd�Zd
d�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�Zd�Z
d�ZRS(cCs7tt|�j�tjtjf|_tjd3dS(Ni(tsuperRtsetUptsystargv(R((s//sys/lib/python2.7/distutils/tests/test_dist.pyR.scCs8|jdt_|jdtj(tt|�j�dS(Nii(RRRRttearDown(R((s//sys/lib/python2.7/distutils/tests/test_dist.pyR3scCs*t�}||_|j�|j�|S(N(RRtparse_config_filestparse_command_line(Rtconfigfilestd((s//sys/lib/python2.7/distutils/tests/test_dist.pytcreate_distribution8s
cCs�ttd��}|jd�|jd�WdQXtg}tjjd�t��}|j|�WdQX|jd�|j |j
�d�ttj
_zFt��}|j|�WdQX|jd�|j |j
�d�Wdttj
_XdS(Ntws [global]
s!command_packages = foo.bar, splattbuildit(topenRtwriteRRtappendRRtseektassertEqualtreadtTruet distutilstdisttDEBUGtFalse(Rtftfileststdout((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_debug_mode?s
cCs9tjjd�|j�}|j|j�dg�dS(NR sdistutils.command(RRR$RR&tget_command_packages(RR((s//sys/lib/python2.7/distutils/tests/test_dist.pyt!test_command_packages_unspecifiedTscCs�ddlm}tjjddddg�|j�}|j|j�ddd g�|jd�}|j ||�|j|j
d
�dS(Ni�(Rs--command-packagessfoo.bar,distutils.testsRs
-Ssometextsdistutils.commandsfoo.barsdistutils.teststsometext(tdistutils.tests.test_distRRRtextendRR&R1tget_command_objtassertIsInstanceR
(RRRtcmd((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_command_packages_cmdlineYs
cCstjjd�|jtjt�ttd�}z|dIJ|dIJWd|j�X|j tg�}|j
|j�dddg�dd dgtjd
)|j tg�}|j
|j�dd g�dddgtjd
)|j tg�}|j
|j�dg�dS(NR Rs[global]s!command_packages = foo.bar, splatsdistutils.commandsfoo.bartsplats--command-packagestsporkiR!(RRR$t
addCleanuptostunlinkRR"tcloseRR&R1(RR-R((s//sys/lib/python2.7/distutils/tests/test_dist.pyt test_command_packages_configfilehs"
cCs�|j�}tjj|d�}t}|didd6dd6dd6d d
6dd6�}|jjt|d
��|didd6dd6dd6dd
6dd6�}tjj|d�}|jjt|d
��dS(NR-tattrsuMister Cafétauthors
my.packagetnameuCafé Juniort
maintaineruCafé torréfiétdescriptionu Héhéhétlong_descriptionRsMister CafesCafe Juniors
Cafe torrefietHehehetf2(tmkdtempR=tpathtjoinRtmetadatatwrite_pkg_fileR"(Rttmp_dirtmy_filetklassR*tmy_file2((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_write_pkg_file�s
cs�g��fd�}|jttdtj�|t_tdidd6dd6dd6dd 6id
6�}|jt��d�|jd
t|��dS(Ncs�j|�dS(N(R$(tmsg(twarns(s//sys/lib/python2.7/distutils/tests/test_dist.pyt_warn�stwarnRAtxxxRBRCtversiontxxxxturltoptionsi( R<tsetattrtwarningsRVRR&tlentassertNotIntdir(RRUR*((RTs//sys/lib/python2.7/distutils/tests/test_dist.pyttest_empty_options�s
cCsiidd6dd6}td|�}|j�|j|jjddg�|j|jjddg�dS(Nsone,twotkeywordst platformsRAtonettwo(Rtfinalize_optionsR&RLRcRb(RRAR*((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_finalize_options�s
cCs�t�}|j|jd�|j�}|j|dg�|j|jdg�d|_|j�}|j|dddg�dS(Nsdistutils.commandsone,twoRdRe(RR&tcommand_packagesR R1(RR*tcmds((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_get_command_packages�s
cCs9t�}d}idd6}|jt|j||�dS(Ntoktok2tlevel(sok(RtassertRaisest
ValueErrortannounce(RR*targstkwargs((s//sys/lib/python2.7/distutils/tests/test_dist.pyt
test_announce�s
cs|j��tjdkr3tjj�d�}ntjj�d�}t|d��}|jd�WdQX�fd�}tjj}|tj_zJtj j
�}|j�}tj j
didgd 6�}|j�}Wd|tj_X|jt
|�d
t
|��dS(Ntposixs.pydistutils.cfgspydistutils.cfgRs[distutils]
cs�S(N((RJ(t temp_home(s//sys/lib/python2.7/distutils/tests/test_dist.pyt _expander�sRAs
--no-user-cfgtscript_argsi(RIR=RCRJRKR"R#t
expanduserR)R*RRR&R^(Rt
user_filenameR-Rvtold_expanderRt all_filesR.((Rus//sys/lib/python2.7/distutils/tests/test_dist.pyttest_find_config_files_disable�s"
((R
RRRRR0R2R9R@RRRaRgRjRsR|(((s//sys/lib/python2.7/distutils/tests/test_dist.pyR)s tMetadataTestCasecBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�ZRS(cCs-tt|�j�tjtjf|_dS(N(RR}RRR(R((s//sys/lib/python2.7/distutils/tests/test_dist.pyR�scCs8|jdt_|jdtj(tt|�j�dS(Nii(RRRR}R(R((s//sys/lib/python2.7/distutils/tests/test_dist.pyR�scCsMidd6dd6dgd6}t|�}|j|�}|jd|�dS(NtBoaRCs3.0RXs#Programming Language :: Python :: 3tclassifierssMetadata-Version: 1.1(Rtformat_metadatatassertIn(RRAR*tmeta((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_classifier�s
cCsJidd6dd6dd6}t|�}|j|�}|jd|�dS(NR~RCs3.0RXshttp://example.org/boatdownload_urlsMetadata-Version: 1.1(RR�R�(RRAR*R�((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_download_url�s
cCsotjd�}idd6dd6|d6}t|�}|j|�}|jdd
d�}|j||�dS(Nsc example::
We start here
and continue here
and end here.tpackageRCs1.0RXRFs
it s (ttextwraptdedentRR�treplaceR�(Rt long_descRAR*R�((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_long_descriptions
cCs�idd6dd6}t|�}|j|�}|jd|�|jd|j��|jd|j��|jd|j��dS( NR�RCs1.0RXsMetadata-Version: 1.0s provides:s requires:s
obsoletes:(RR�R�R_tlower(RRAR*R�((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_simple_metadatas
cCs�idd6dd6ddgd6}t|�}|j|jj�ddg�|j|j�ddg�|j|�}|jd|�|jd|j��|jd |j��dS(
NR�RCs1.0RXspackage.subtprovidessMetadata-Version: 1.1s requires:s
obsoletes:(RR&RLtget_providesR�R�R_R�(RRAR*R�((s//sys/lib/python2.7/distutils/tests/test_dist.pyt
test_providess
cCs/|jttidd6dd6dgd6�dS(NR�RCs1.0RXsmy.pkg (splat)R�(RnRoR(R((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_provides_illegal-s
cCs�idd6dd6ddgd6}t|�}|j|jj�ddg�|j|j�ddg�|j|�}|jd|�|jd |j��|jd
|�|jd|�|jd|j��dS(
NR�RCs1.0RXtothersanother (==1.0)trequiressMetadata-Version: 1.1s provides:sRequires: othersRequires: another (==1.0)s
obsoletes:(RR&RLtget_requiresR�R�R_R�(RRAR*R�((s//sys/lib/python2.7/distutils/tests/test_dist.pyt
test_requires3s
cCs/|jttidd6dd6dgd6�dS(NR�RCs1.0RXsmy.pkg (splat)R�(RnRoR(R((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_requires_illegalCs
cCs�idd6dd6ddgd6}t|�}|j|jj�ddg�|j|j�ddg�|j|�}|jd|�|jd |j��|jd
|j��|jd|�|jd|�dS(
NR�RCs1.0RXR�sanother (<1.0)t obsoletessMetadata-Version: 1.1s provides:s requires:sObsoletes: othersObsoletes: another (<1.0)(RR&RLt
get_obsoletesR�R�R_R�(RRAR*R�((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_obsoletesIs
cCs/|jttidd6dd6dgd6�dS(NR�RCs1.0RXsmy.pkg (splat)R�(RnRoR(R((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_obsoletes_illegalYs
cCs&tj�}|jj|�|j�S(N(tStringIORLRMtgetvalue(RR*tsio((s//sys/lib/python2.7/distutils/tests/test_dist.pyR�_scCstjdkrd}nd}|j�}tjj||�}t|d�}z|jd�Wd|j�Xz�t�}t j
dkr�|tjd<|j�}|j
||�nt j
d kr�tjd<|j�}|j
||d
||f�nWdtj|�XdS(NRts.pydistutils.cfgspydistutils.cfgRt.tlinuxtdarwintHOMEtwin32s%r not found in %r(slinuxsdarwin(R=RCRIRJRKR"R#R?RRtplatformtenvironRR�tremove(RRyttemp_dirR-R*R.((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_custom_pydistutilsds*
cCsDd
dg}t|�}|j|d d�|j|dd
�dS(NtatbtcRiiiii(R�R�R�R(iiii(R�R�R�(iii(RR&(Rthelp_tuplest
fancy_options((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_fix_help_options�scCs�t�}gt_d|_d|_t��}|j�WdQXg|j�jd�D]}|j �dkrV|^qV}|j
|�dS(Nissetup.pys
R!(RRRthelptscript_nameRRR�tsplittstript
assertTrue(RR*tstlinetoutput((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_show_help�s cCs0idd6dd6dd6dd6d d
6ddgd
6dgd6}t|�}|j}tj�}|j|�|jd�|j|�|j|jd�|j|jd�|j|j d�|j|j
d �|j|jddg�|j|jdg�|j|j
d�|j|jdg�dS(NR�RCs1.0RXtdescRFRWREshttp://example.comR�RdReRbtfooR�itUNKNOWN(RRLR�RMR%t
read_pkg_fileR&RCRXRER�RbRcR�R R�(RRAR*RLtPKG_INFO((s//sys/lib/python2.7/distutils/tests/test_dist.pyttest_read_metadata�s*
(R
RRRR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s//sys/lib/python2.7/distutils/tests/test_dist.pyR}�s"
#
cCs<tj�}|jtjt��|jtjt��|S(N(tunittestt TestSuitetaddTestt makeSuiteRR}(tsuite((s//sys/lib/python2.7/distutils/tests/test_dist.pyt
test_suite�st__main__(RR=R�RR�R]R�tdistutils.distRRt
distutils.cmdRR)ttest.test_supportRRRtdistutils.testsRRRtTempdirManagertLoggingSilencertEnvironGuardtTestCaseRR}R�R
(((s//sys/lib/python2.7/distutils/tests/test_dist.pyt<module>s, ��
|