ó ükWc@sWdZddlZddlZddlZddlZddlZddlZddlmZm Z ddl m Z ddlZ ddl mZmZmZmZddlmZde fd„ƒYZd efd „ƒYZd ejejejejfd „ƒYZd ejejejfd„ƒYZd„ZedkrSeeƒƒndS(sTests for distutils.dist.iÿÿÿÿN(t Distributiontfix_help_options(tCommand(tTESTFNtcaptured_stdoutt run_unittesttunlink(tsupportt test_distcBs eZdZdgZd„ZRS(s#Sample distutils extension command.ssample-option=tSs help textcCs d|_dS(N(tNonet sample_option(tself((s//usr/lib/python2.7/distutils/tests/test_dist.pytinitialize_optionss(ssample-option=R s help text(t__name__t __module__t__doc__t user_optionsR (((s//usr/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//usr/lib/python2.7/distutils/tests/test_dist.pytfind_config_files%s(RRRR(((s//usr/lib/python2.7/distutils/tests/test_dist.pyRstDistributionTestCasecBs€eZd„Zd„Zd d„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „ZRS(cCs7tt|ƒjƒtjtjf|_tjd3dS(Ni(tsuperRtsetUptsystargv(R ((s//usr/lib/python2.7/distutils/tests/test_dist.pyR.scCs8|jdt_|jdtj(tt|ƒjƒdS(Nii(RRRRttearDown(R ((s//usr/lib/python2.7/distutils/tests/test_dist.pyR3scCs*tƒ}||_|jƒ|jƒ|S(N(RRtparse_config_filestparse_command_line(R t configfilestd((s//usr/lib/python2.7/distutils/tests/test_dist.pytcreate_distribution8s     cCsttdƒ!}|jdƒ|jdƒWdQX|jttƒtg}tjjdƒtƒ}|j |ƒWdQX|j dƒ|j |j ƒdƒt tj_zFtƒ}|j |ƒWdQX|j dƒ|j |j ƒdƒWdttj_XdS(Ntws [global] s!command_packages = foo.bar, splattbuildit(topenRtwritet addCleanupRRRtappendRRtseekt assertEqualtreadtTruet distutilstdisttDEBUGtFalse(R tftfileststdout((s//usr/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(R R((s//usr/lib/python2.7/distutils/tests/test_dist.pyt!test_command_packages_unspecifiedUs cCsddlm}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(R3tget_command_objtassertIsInstanceR (R RRtcmd((s//usr/lib/python2.7/distutils/tests/test_dist.pyttest_command_packages_cmdlineZs   cCstjjdƒ|jtjtƒttdƒ}z|dIJ|dIJWd|jƒX|j tgƒ}|j |j ƒdddgƒdd dgtjd )|j tgƒ}|j |j ƒdd gƒdd dgtjd )|j tgƒ}|j |j ƒdgƒdS( NR!R s[global]s!command_packages = foo.bar, splatsdistutils.commandsfoo.bartsplats--command-packagestsporkiR"( RRR&R%tosRRR#tcloseRR(R3(R R/R((s//usr/lib/python2.7/distutils/tests/test_dist.pyt test_command_packages_configfileis"   cCsÖ|jƒ}tjj|dƒ}t}|didd6dd6dd6d d 6d d 6ƒ}|jjt|d ƒƒ|didd6dd6dd6dd 6dd 6ƒ}tjj|dƒ}|jjt|d ƒƒdS(NR/tattrsu Mister Cafétauthors my.packagetnameu Café Juniort maintaineruCafé torréfiét descriptionu Héhéhétlong_descriptionR s Mister Cafes Cafe Juniors Cafe torrefietHehehetf2(tmkdtempR>tpathtjoinRtmetadatatwrite_pkg_fileR#(R ttmp_dirtmy_filetklassR,tmy_file2((s//usr/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//usr/lib/python2.7/distutils/tests/test_dist.pyt_warn¥stwarnRAtxxxRBRCtversiontxxxxturltoptionsi( R%tsetattrtwarningsRVRR(tlent assertNotIntdir(R RUR,((RTs//usr/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(R RAR,((s//usr/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 R3(R R,tcmds((s//usr/lib/python2.7/distutils/tests/test_dist.pyttest_get_command_packages¼s      cCs9tƒ}d}idd6}|jt|j||ƒdS(Ntoktok2tlevel(sok(Rt assertRaisest ValueErrortannounce(R R,targstkwargs((s//usr/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|j t |ƒd t |ƒƒdS( Ntposixs.pydistutils.cfgspydistutils.cfgR s [distutils] csˆS(N((RJ(t temp_home(s//usr/lib/python2.7/distutils/tests/test_dist.pyt _expanderÚsRAs --no-user-cfgt script_argsi(RIR>RCRJRKR#R$t expanduserR+R,RRR(R^(R t user_filenameR/Rvt old_expanderRt all_filesR0((Rus//usr/lib/python2.7/distutils/tests/test_dist.pyttest_find_config_files_disableÏs"     ((RRRRRR2R4R;R@RRRaRgRjRsR|(((s//usr/lib/python2.7/distutils/tests/test_dist.pyR)s          tMetadataTestCasecBs¡eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„Zd„ZRS(cCs-tt|ƒjƒtjtjf|_dS(N(RR}RRR(R ((s//usr/lib/python2.7/distutils/tests/test_dist.pyRðscCs8|jdt_|jdtj(tt|ƒjƒdS(Nii(RRRR}R(R ((s//usr/lib/python2.7/distutils/tests/test_dist.pyRôscCsMidd6dd6dgd6}t|ƒ}|j|ƒ}|jd|ƒdS(NtBoaRCs3.0RXs#Programming Language :: Python :: 3t classifierssMetadata-Version: 1.1(Rtformat_metadatatassertIn(R RAR,tmeta((s//usr/lib/python2.7/distutils/tests/test_dist.pyttest_classifierùs   cCsJidd6dd6dd6}t|ƒ}|j|ƒ}|jd|ƒdS(NR~RCs3.0RXshttp://example.org/boat download_urlsMetadata-Version: 1.1(RR€R(R RAR,R‚((s//usr/lib/python2.7/distutils/tests/test_dist.pyttest_download_urls   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(R t long_descRAR,R‚((s//usr/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€RR_tlower(R RAR,R‚((s//usr/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.0RXs package.subtprovidessMetadata-Version: 1.1s requires:s obsoletes:(RR(RLt get_providesR€RR_R(R RAR,R‚((s//usr/lib/python2.7/distutils/tests/test_dist.pyt test_provides s    cCs/|jttidd6dd6dgd6ƒdS(NR†RCs1.0RXsmy.pkg (splat)R(RnRoR(R ((s//usr/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(RLt get_requiresR€RR_R(R RAR,R‚((s//usr/lib/python2.7/distutils/tests/test_dist.pyt test_requires4s    cCs/|jttidd6dd6dgd6ƒdS(NR†RCs1.0RXsmy.pkg (splat)R”(RnRoR(R ((s//usr/lib/python2.7/distutils/tests/test_dist.pyttest_requires_illegalDs  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€RR_R(R RAR,R‚((s//usr/lib/python2.7/distutils/tests/test_dist.pyttest_obsoletesJs    cCs/|jttidd6dd6dgd6ƒdS(NR†RCs1.0RXsmy.pkg (splat)R˜(RnRoR(R ((s//usr/lib/python2.7/distutils/tests/test_dist.pyttest_obsoletes_illegalZs  cCs&tjƒ}|jj|ƒ|jƒS(N(tStringIORLRMtgetvalue(R R,tsio((s//usr/lib/python2.7/distutils/tests/test_dist.pyR€`s cCstjdkrd}nd}|jƒ}tjj||ƒ}t|dƒ}z|jdƒWd|jƒXztƒ}t j d kr´|tj d<|j ƒ}|j ||ƒnt j d krü|tj d<|j ƒ}|j ||d ||fƒnWdtj|ƒXdS( NRts.pydistutils.cfgspydistutils.cfgR t.tlinuxtdarwintHOMEtwin32s%r not found in %r(slinuxsdarwin(R>RCRIRJRKR#R$R?RRtplatformtenvironRRtremove(R Ryttemp_dirR/R,R0((s//usr/lib/python2.7/distutils/tests/test_dist.pyttest_custom_pydistutilses*         cCsDd d g}t|ƒ}|j|d d ƒ|j|dd ƒdS(NtatbtcRiiiii(R©RªR«R(iiii(R©RªR«(iii(RR((R t help_tuplest fancy_options((s//usr/lib/python2.7/distutils/tests/test_dist.pyttest_fix_help_optionsˆs  cCs‹tƒ}gt_d|_d|_tƒ}|jƒWdQXg|jƒjdƒD]}|j ƒdkrV|^qV}|j |ƒdS(Nissetup.pys R"( RRRthelpt script_nameRRRtsplittstript assertTrue(R R,tstlinetoutput((s//usr/lib/python2.7/distutils/tests/test_dist.pyttest_show_helpŽs     cCs0idd6dd6dd6dd6d d 6d d gd 6dgd6}t|ƒ}|j}tjƒ}|j|ƒ|jdƒ|j|ƒ|j|jdƒ|j|jdƒ|j|j dƒ|j|j d ƒ|j|j d d gƒ|j|j dgƒ|j|j dƒ|j|jdgƒdS(NR†RCs1.0RXtdescRFRWREshttp://example.comR„RdReRbtfooR”itUNKNOWN(RRLRœRMR't read_pkg_fileR(RCRXRER„RbRcR˜R R”(R RAR,RLtPKG_INFO((s//usr/lib/python2.7/distutils/tests/test_dist.pyttest_read_metadata›s*         (RRRRRƒR…RŒRŽR‘R’R–R—RšR›R€R¨R®R·R½(((s//usr/lib/python2.7/distutils/tests/test_dist.pyR}ís"             #  cCs<tjƒ}|jtjtƒƒ|jtjtƒƒ|S(N(tunittestt TestSuitetaddTestt makeSuiteRR}(tsuite((s//usr/lib/python2.7/distutils/tests/test_dist.pyt test_suite·s t__main__(RR>RœRR¾R]Rˆtdistutils.distRRt distutils.cmdRR+ttest.test_supportRRRRtdistutils.testsRRRtTempdirManagertLoggingSilencert EnvironGuardtTestCaseRR}RÃR(((s//usr/lib/python2.7/distutils/tests/test_dist.pyts,       "  ÁÉ