ó «©\Tc@svdZddlZddlZddlZddlZddlZddlZddlmZm Z m Z ddlm Z ddl Z ddl Z ddlZddlmZm Z m Z m Z ddlmZmZddlmZmZmZddlmZdd lmZdd lmZdd lmZddlZyKe d ƒddl!Z!e!j"d ƒZ#e!j$d e!j%dej&ƒe'Z(Wne)k r¨e*Z(dZ#nXde,fd„ƒYZ-deej.dƒZ/dZ0dej1fd„ƒYZ2dej1fd„ƒYZ3dej1fd„ƒYZ4dej1fd„ƒYZ5d„Z6d„d„Z7d„Z8d „Z9d!„Z:dS("sEasy install Tests iÿÿÿÿN(tStringIOtBytesIOtnext(turlparse(RRRR(t run_setuptSandboxViolation(t easy_installtfix_jython_executabletget_script_args(tPthDistributions(R(t Distributiontmultiprocessingttest_easy_installtleveltstreamtFakeDistcBseZd„Zd„ZRS(cCs|dkriSidd6S(Ntconsole_scriptsteptname((tselftgroup((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyt get_entry_map$s cCsdS(Ntspec((R((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pytas_requirement)s(t__name__t __module__RR(((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyR#s sü#!%s # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name' __requires__ = 'spec' import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.exit( load_entry_point('spec', 'console_scripts', 'name')() ) ts0from setuptools import setup setup(name='foo') tTestEasyInstallTestcBs#eZd„Zd„Zd„ZRS(cCs„tƒ}t|ƒ}t|_tjƒ|_z?|jƒtj j |jdƒ}|j tj j |ƒƒWdt j|jƒXdS(Nssite.py(R RtFalsetsitepy_installedttempfiletmkdtempt install_dirtinstall_site_pytostpathtjoint assertTruetexiststshutiltrmtree(Rtdisttcmdtsitepy((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyttest_install_site_pyAs    cCsitƒ}tj}z6gtt|ƒƒD] }|^q(dd!\}}Wd|t_X|j|tƒdS(Nii(RtsystplatformRRt assertEqualtWANTED(RR)t old_platformtiRtscript((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyttest_get_script_argsMs   6 cCstƒ}t|ƒ}d„|_t|_ddg|_tjjt j ƒdƒ|_ dg|_ |j ƒ|j|jjiƒt|ƒ}d„|_ddg|_tjjt j ƒdƒ|_ dg|_ |j ƒt|jjjƒƒ}|j|ddgƒdS(NcSstS(N(tTrue(((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyt]stlink1tlink2tokcSstS(N(R5(((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyR6gs(R Rtcheck_pth_processingR5t no_find_linkst find_linksR"R#R$RRR targstensure_finalizedR/t package_indext scanned_urlstsortedtkeys(RR)R*RB((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyttest_no_find_linksXs"          (RRR,R4RC(((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyR?s tTestPTHFileWritercBseZd„Zd„ZRS(cCsVtdtjƒgƒ}|j|j ƒ|jttjƒƒƒ|j|jƒdS(sba pth file manager should set dirty if a distribution is in site but also the cwd sdoes-not_existN(R R"tgetcwdR%tdirtytaddtPRDistribution(Rtpth((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyt!test_add_from_cwd_site_sets_dirtyqscCsitjdkrd}nd}td|gƒ}|j|j ƒ|jt|ƒƒ|j|j ƒdS(Ntnts%/test/location/does-not-have-to-existsc:\does_not_existsdoes-not_exist(R"RR R%RFRGRH(RtlocationRI((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyttest_add_from_site_is_ignoredzs (RRRJRM(((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyRDps tTestUserInstallTestcBsGeZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCsÜtjƒ|_tjj|jdƒ}t|dƒ}|jtƒ|j ƒtj ƒ|_ tj |jƒt jdkrØtj|_tj|_tj|_tjƒt_tj|_tjƒt_tjt_ndS(Nssetup.pytws2.6(RRtdirR"R#R$topentwritetSETUP_PYtcloseREtold_cwdtchdirR-tversionteasy_install_pkgt HAS_USER_SITEt old_has_sitet__file__told_filetsitet USER_BASEtold_baset USER_SITEtold_site(Rtsetuptf((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pytsetUp‡s      cCs†tj|jƒtj|jƒtjdkr‚tjtj ƒtjtj ƒ|j t_ |j t_ |j t_|jt_ndS(Ns2.6(R"RVRUR'R(RPR-RWR]R^R`R_RaRZRXRYR\R[(R((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyttearDown˜s   cCsgtt_tjdkrdStƒ}d|_t|ƒ}dg|_|j ƒ|j |j dƒdS(Ns2.6ssetup.pytpysuser should be implied( R5RXRYR-RWR t script_nameRR=R>R%tuser(RR)R*((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyttest_user_install_implied£s      cCsts dStjdƒdS(Nsthis should not break(t _MULTIPROCt_LOGtinfo(R((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyttest_multiproc_atexit¯scCsgtt_tjdkrdStƒ}d|_t|ƒ}dg|_|j ƒ|j |j dƒdS(Ns2.6ssetup.pyRfsNOT user should be implied( RRXRYR-RWR RgRR=tinitialize_optionst assertFalseRh(RR)R*((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyt6test_user_install_not_implied_without_usersite_enabled´s      c CsÆtjƒ}tjƒ}tjj|dƒ}t|dƒ}z|jdƒWd|jƒXtjj |ƒtj j dƒ}tjj jtjƒtj dt local_indextscanR/trealpathRLtremoveR&tisdirR'R(tNone( Rt new_locationttargettegg_fileRct old_ppathR)R*trestbasedir((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyttest_local_indexÀs@         & csgidd6dd6dgd6tjj|jƒgd6}tjj|jdƒ}tjj|dƒ‰tjj|d ƒ}tj|ƒtˆd ƒ}|jtj d |ƒƒ|j ƒtjj|jd ƒ}t |tj d ƒƒt j }t j}tƒt _ tƒt _z<yt‡fd†ƒWntk rK|jdƒnXWd|t _ |t _XdS(sáRegression test for Distribute issue #318 Ensure that a package with setup_requires can be installed when setuptools is installed in the user site-packages without causing a SandboxViolation. ttest_pkgRs0.0RWtfoobartsetup_requirestdependency_linksssetup.pys setup.cfgROsI import setuptools setuptools.setup(**%r) sfoobar-0.1.tar.gzs§ import setuptools setuptools.setup( name='foobar', version='0.1' ) cstˆdgƒS(Ntinstall(R((t test_setup_py(sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyR6ss$Installation caused SandboxViolationN(R"R#tabspathRPR$tmkdirRQRRttextwraptdedentRTtmake_trivial_sdistR-tstdouttstderrRtreset_setup_stop_contextRtfail(Rttest_setup_attrsR„ttest_setup_cfgRct foobar_patht old_stdoutt old_stderr((R‰sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyttest_setup_requiresés:           ( RRRdReRiRmRpRƒR˜(((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyRN…s   )tTestSetupRequirescBseZd„Zd„ZRS(cs´tjjjƒ‰ˆjƒd}tˆjƒ|‰ˆjdƒrHdS‡‡‡fd†}ˆj|ƒˆj dt ˆj ƒkodknƒˆj ˆj dj dƒdS( sÉ When easy_install installs a source distribution which specifies setup_requires, it should honor the fetch parameters (such as allow-hosts, index-url, and find-links). is:0Ncs&‡‡‡‡fd†}t|ƒdS(Ncs/‡‡‡‡‡fd†}t|dˆƒdS(NcsAdˆjdˆddˆˆg‰‡‡fd†}t|ƒdS(Ns --index-urls --allow-hostss--exclude-scriptss --install-dircs&‡‡fd†}t|dgƒdS(NcsˆjttjˆƒdS(N(t assertRaisest SystemExitRXtmain((t ei_paramsR(sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pytinstall_clean_argv>s R(t argv_context(Rž(RR(sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pytinstall_clean_reset=s(turlR‘(R (t dist_filetp_indext p_index_locRttemp_install_dir(RsO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyt install_env8s    Rq(tenvironment_context(R¥R¦(R¢R£R¤R(R¥sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyt install_at7s (ttempdir_context(R¢R¨(R£R¤R(R¢sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyRˆ6siiis/does-not-exist/(t setuptoolstteststservert MockServertstartRR¡tendswitht create_sdistR%tlentrequestsR/R#(RtnetlocRˆ((R£R¤RsO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyt'test_setup_requires_honors_fetch_params s  ,cs‡fd†}t|ƒdS(sˆ Create an sdist with a setup_requires dependency (of something that doesn't exist) and invoke installer on it. cs?tjj|dƒ}t|tjdƒjƒƒˆ|ƒdS(Ns"setuptools-test-fetcher-1.0.tar.gzs import setuptools setuptools.setup( name="setuptools-test-fetcher", version="1.0", setup_requires = ['does-not-exist'], ) (R"R#R$RŽRŒRtlstrip(RPt dist_path(t installer(sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyt build_sdistUs N(R©(RR·R¸((R·sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyR°Ps (RRR´R°(((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyR™s 0cCs›tjddƒ}y t}Wntk r5t}nX||jdƒƒ}t|jƒƒ|_tj |dƒ}z|j |d|ƒWd|j ƒXdS(s‹Create a simple sdist tarball at dist_path, containing just a setup.py, the contents of which are provided by the setup_py string. Rssetup.pysutf-8sw:gztfileobjN( ttarfiletTarInfoRtAttributeErrorRtencodeR±tgetvaluetsizeRQtaddfileRT(R¶tsetup_pyt setup_py_filetMemFiletsetup_py_bytesR)((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyRŽes   cCsdS(N(R|(RP((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyR6yscCsOtjƒ}tjƒ}z||ƒ||ƒWd||ƒtj|ƒXdS(s! Invoke f in the context N(RRR"RER'R((Rctcdttemp_dirtorig_dir((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyR©ys    cKs]tjjƒ}tjj|ƒz |ƒWdx|D]}tj|=q4Wtjj|ƒXdS(s! Invoke f in the context N(R"Rttcopytupdate(Rctupdatestold_envtkey((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyR§†s  cCs1tj}|tj(z |ƒWd|tj(XdS(s! Invoke f in the context N(R-targv(Rctrepltold_argv((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyRŸ“s    cCs7tjj}dtj_z |ƒWd|tj_XdS(s When the setuptools tests are run using setup.py test, and then one wants to invoke another setup() command (such as easy_install) within those tests, it's necessary to reset the global variable in distutils.core so that the setup() command will run naturally. N(t distutilstcoret_setup_stop_afterR|(Rctsetup_stop_after((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pyR‘žs    (;t__doc__R-R"R'RtunittestR]tsetuptools.compatRRRRRŒRºtdistutils.coreRÐtsetuptools.sandboxRRtsetuptools.command.easy_installRRRR tsetuptools.commandRXtsetuptools.distR t pkg_resourcesRHtsetuptools.tests.serverRªt __import__tloggingt getLoggerRkt basicConfigtINFORR5Rjt ImportErrorRR|tobjectRt executableR0RStTestCaseRRDRNR™RŽR©R§RŸR‘(((sO/opt/freeware/lib/python2.7/site-packages/setuptools/tests/test_easy_install.pytsP         "      1™G