Ñò
b-äQc           @   sx  d  Z  d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k l Z l	 Z	 l
 Z
 d d k l Z d d k Z d d k Z d d k Z d d k l Z l	 Z	 l
 Z
 l Z d d k l Z l Z d d k l Z l Z l Z d d k l Z d d	 k l Z d d
 k l Z d d
 k l Z d d k Z yK e  d ƒ d d k! Z! e! i" d ƒ Z# e! i$ d e! i% d e i& ƒ e' Z( Wn e) j
 o e* Z( d Z# n Xd e, f d „  ƒ  YZ- d e e i. d ƒ Z/ d Z0 d e i1 f d „  ƒ  YZ2 d e i1 f d „  ƒ  YZ3 d e i1 f d „  ƒ  YZ4 d e i1 f d „  ƒ  YZ5 d „  Z6 d „  d „ Z7 d „  Z8 d  „  Z9 d! „  Z: d S("   s   Easy install Tests
iÿÿÿÿN(   t   StringIOt   BytesIOt   next(   t   urlparse(   R    R   R   R   (   t	   run_setupt   SandboxViolation(   t   easy_installt   fix_jython_executablet   get_script_args(   t   PthDistributions(   R   (   t   Distributiont   multiprocessingt   test_easy_installt   levelt   streamt   FakeDistc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | d j o h  Sh d d 6S(   Nt   console_scriptst   ept   name(    (   t   selft   group(    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   get_entry_map$   s    c         C   s   d S(   Nt   spec(    (   R   (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   as_requirement)   s    (   t   __name__t
   __module__R   R   (    (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/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')()
    )
t    s0   from setuptools import setup

setup(name='foo')
t   TestEasyInstallTestc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s„   t  ƒ  } t | ƒ } t | _ t i ƒ  | _ z? | i ƒ  t i	 i
 | i d ƒ } |  i t i	 i | ƒ ƒ Wd  t i | i ƒ Xd  S(   Ns   site.py(   R
   R   t   Falset   sitepy_installedt   tempfilet   mkdtempt   install_dirt   install_site_pyt   ost   patht   joint
   assertTruet   existst   shutilt   rmtree(   R   t   distt   cmdt   sitepy(    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   test_install_site_pyA   s    		
c      	   C   sq   t  ƒ  } t i } z> g  } t t | ƒ ƒ D] } | | q, ~ d d !\ } } Wd  | t _ X|  i | t ƒ d  S(   Ni    i   (   R   t   syst   platformR   R   t   assertEqualt   WANTED(   R   R)   t   old_platformt   _[1]t   iR   t   script(    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   test_get_script_argsM   s    		>
c         C   s  t  ƒ  } t | ƒ } d „  | _ t | _ d d g | _ t i i t	 i
 ƒ  d ƒ | _ d g | _ | i ƒ  |  i | i i h  ƒ t | ƒ } d „  | _ d d g | _ t i i t	 i
 ƒ  d ƒ | _ d g | _ | i ƒ  t | i i i ƒ  ƒ } |  i | d d g ƒ d  S(   Nc           S   s   t  S(    (   t   True(    (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   <lambda>]   s    t   link1t   link2t   okc           S   s   t  S(    (   R6   (    (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyR7   g   s    (   R
   R   t   check_pth_processingR6   t   no_find_linkst
   find_linksR"   R#   R$   R   R   R    t   argst   ensure_finalizedR/   t   package_indext   scanned_urlst   sortedt   keys(   R   R)   R*   RC   (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   test_no_find_linksX   s"    		

(   R   R   R,   R5   RD   (    (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyR   ?   s   		t   TestPTHFileWriterc           B   s   e  Z d  „  Z d „  Z RS(   c         C   sV   t  d t i ƒ  g ƒ } |  i | i ƒ | i t t i ƒ  ƒ ƒ |  i | i ƒ d S(   sb   a pth file manager should set dirty
        if a distribution is in site but also the cwd
        s   does-not_existN(   R	   R"   t   getcwdR%   t   dirtyt   addt   PRDistribution(   R   t   pth(    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt!   test_add_from_cwd_site_sets_dirtyq   s    c         C   sk   t  i d j o
 d } n d } t d | g ƒ } |  i | i ƒ | i t | ƒ ƒ |  i | i ƒ d  S(   Nt   nts%   /test/location/does-not-have-to-exists   c:\does_not_exists   does-not_exist(   R"   R   R	   R%   RG   RH   RI   (   R   t   locationRJ   (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   test_add_from_site_is_ignoredz   s    
(   R   R   RK   RN   (    (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyRE   p   s   		t   TestUserInstallTestc           B   sG   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sÞ   t  i ƒ  |  _ t i i |  i d ƒ } t | d ƒ } | i t ƒ | i	 ƒ  t i
 ƒ  |  _ t i |  i ƒ t i d j o^ t i |  _ t i |  _ t i |  _ t  i ƒ  t _ t i |  _ t  i ƒ  t _ t i t _ n d  S(   Ns   setup.pyt   ws   2.6(   R   R   t   dirR"   R#   R$   t   opent   writet   SETUP_PYt   closeRF   t   old_cwdt   chdirR-   t   versiont   easy_install_pkgt   HAS_USER_SITEt   old_has_sitet   __file__t   old_filet   sitet	   USER_BASEt   old_baset	   USER_SITEt   old_site(   R   t   setupt   f(    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   setUp‡   s    
c         C   sˆ   t  i |  i ƒ t i |  i ƒ t i d j oT t i t i	 ƒ t i t i
 ƒ |  i t _	 |  i t _
 |  i t _ |  i t _ n d  S(   Ns   2.6(   R"   RW   RV   R'   R(   RQ   R-   RX   R^   R_   Ra   R`   Rb   R[   RY   RZ   R]   R\   (   R   (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   tearDown˜   s    c         C   si   t  t _ t i d j  o d  St ƒ  } d | _ t | ƒ } d g | _ | i	 ƒ  |  i
 | i d ƒ d  S(   Ns   2.6s   setup.pyt   pys   user should be implied(   R6   RY   RZ   R-   RX   R
   t   script_nameR   R>   R?   R%   t   user(   R   R)   R*   (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   test_user_install_implied£   s    			
c         C   s   t  p d  St i d ƒ d  S(   Ns   this should not break(   t
   _MULTIPROCt   _LOGt   info(   R   (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   test_multiproc_atexit¯   s    c         C   si   t  t _ t i d j  o d  St ƒ  } d | _ t | ƒ } d g | _ | i	 ƒ  |  i
 | i d ƒ d  S(   Ns   2.6s   setup.pyRg   s   NOT user should be implied(   R   RY   RZ   R-   RX   R
   Rh   R   R>   t   initialize_optionst   assertFalseRi   (   R   R)   R*   (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt6   test_user_install_not_implied_without_usersite_enabled´   s    			
c   
      C   sË  t  i ƒ  } t  i ƒ  } t i i | d ƒ } t | d ƒ } z | i d ƒ Wd  | i ƒ  Xt i i	 | ƒ t i
 i d ƒ } t i i i t i ƒ t i
 d <zŽ t ƒ  } d | _ t | ƒ } | | _ d g | _ | i ƒ  | i i | g ƒ | i d ƒ } |  i t i i | i ƒ t i i | ƒ ƒ Wd  t i i | ƒ x^ | | g D]P }	 t i i |	 ƒ p t i i |	 ƒ o qJn y t i |	 ƒ WqJqJXqJW| d  j	 o | t i
 d <n t i
 d =Xd  S(   Ns   foo-1.0.egg-infoRP   s
   Name: foo
t
   PYTHONPATHs   setup.pyt   foo(   R   R   R"   R#   R$   RR   RS   RU   R-   t   appendt   environt   gett   pathsepR
   Rh   R   R    R>   R?   t   local_indext   scanR/   t   realpathRM   t   removeR&   t   isdirR'   R(   t   None(
   R   t   new_locationt   targett   egg_fileRd   t	   old_ppathR)   R*   t   rest   basedir(    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   test_local_indexÀ   sB    			
 (c      
      si  h d d 6d d 6d g d 6t  i i |  i ƒ g d 6} t  i i |  i d ƒ } t  i i | d ƒ ‰  t  i i | d	 ƒ } t  i | ƒ t ˆ  d
 ƒ } | i t i	 d | ƒ ƒ | i
 ƒ  t  i i |  i d ƒ } t | t i	 d ƒ ƒ t i } t i } t ƒ  t _ t ƒ  t _ z> y t ‡  f d †  ƒ Wn  t j
 o |  i d ƒ n XWd | t _ | t _ Xd S(   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.
        t   test_pkgR   s   0.0RX   t   foobart   setup_requirest   dependency_linkss   setup.pys	   setup.cfgRP   sI               import setuptools
            setuptools.setup(**%r)
        s   foobar-0.1.tar.gzs§                   import setuptools
                setuptools.setup(
                    name='foobar',
                    version='0.1'
                )
            c              s   t  ˆ  d  g ƒ S(   t   install(   R   (    (   t   test_setup_py(    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyR7     s    s$   Installation caused SandboxViolationN(   R"   R#   t   abspathRQ   R$   t   mkdirRR   RS   t   textwrapt   dedentRU   t   make_trivial_sdistR-   t   stdoutt   stderrR    t   reset_setup_stop_contextR   t   fail(   R   t   test_setup_attrsR…   t   test_setup_cfgRd   t   foobar_patht
   old_stdoutt
   old_stderr(    (   RŠ   s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   test_setup_requiresé   s:    


			(	   R   R   Re   Rf   Rj   Rn   Rq   R„   R™   (    (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyRO   …   s   						)t   TestSetupRequiresc           B   s   e  Z d  „  Z d „  Z RS(   c            s·   t  i i i ƒ  ‰  ˆ  i ƒ  d } t ˆ  i ƒ | ‰ ˆ i d ƒ o d S‡ ‡ ‡  f d †  } ˆ i | ƒ ˆ i	 d t
 ˆ  i ƒ j o
 d j n ƒ ˆ i ˆ  i d i d ƒ d S(	   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).
        i   s   :0Nc            s&   ‡  ‡ ‡ ‡ f d †  } t  | ƒ d  S(   Nc            s/   ‡ ‡  ‡ ‡ ‡ f d †  } t  | d ˆ  ƒd  S(   Nc             sA   d ˆ i  d ˆ d d ˆ ˆ g ‰  ‡  ‡ f d †  }  t |  ƒ d  S(   Ns   --index-urls   --allow-hostss   --exclude-scriptss   --install-dirc             s&   ‡ ‡  f d †  }  t  |  d g ƒ d  S(   Nc              s   ˆ  i  t t i ˆ ƒ d  S(   N(   t   assertRaisest
   SystemExitRY   t   main(    (   R   t	   ei_params(    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   install_clean_argv>  s    	R   (   t   argv_context(   RŸ   (   Rž   R   (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   install_clean_reset=  s    (   t   urlR’   (   R¡   (   t	   dist_filet   temp_install_dirt   p_index_loct   p_indexR   (   Rž   s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   install_env8  s    			Rr   (   t   environment_context(   R¤   R§   (   R£   R¥   R¦   R   (   R¤   s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt
   install_at7  s    (   t   tempdir_context(   R£   R©   (   R   R¥   R¦   (   R£   s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyR‰   6  s    i   i   i    s   /does-not-exist/(   t
   setuptoolst   testst   servert
   MockServert   startR   R¢   t   endswitht   create_sdistR%   t   lent   requestsR/   R#   (   R   t   netlocR‰   (    (   R¦   R   R¥   s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt'   test_setup_requires_honors_fetch_params   s    
-c            s   ‡  f d †  } t  | ƒ d S(   sˆ   
        Create an sdist with a setup_requires dependency (of something that
        doesn't exist) and invoke installer on it.
        c            s?   t  i i |  d ƒ } t | t i d ƒ i ƒ  ƒ ˆ  | ƒ d  S(   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   RŽ   t   lstrip(   RQ   t	   dist_path(   t	   installer(    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   build_sdistU  s    N(   Rª   (   R   R¸   R¹   (    (   R¸   s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyR±   P  s    (   R   R   Rµ   R±   (    (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyRš     s   	0c      
   C   s   t  i d d ƒ } y
 t } Wn t j
 o t } n X| | i d ƒ ƒ } t | i ƒ  ƒ | _ t  i	 |  d ƒ } z | i
 | d | ƒWd | i ƒ  Xd S(   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.
    R   s   setup.pys   utf-8s   w:gzt   fileobjN(   t   tarfilet   TarInfoR   t   AttributeErrorR    t   encodeR²   t   getvaluet   sizeRR   t   addfileRU   (   R·   t   setup_pyt   setup_py_filet   MemFilet   setup_py_bytesR)   (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyR   e  s    
c         C   s   d  S(   N(   R}   (   RQ   (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyR7   y  s    c         C   sO   t  i ƒ  } t i ƒ  } z | | ƒ |  | ƒ Wd | | ƒ t i | ƒ Xd S(   s!   
    Invoke f in the context
    N(   R   R   R"   RF   R'   R(   (   Rd   t   cdt   temp_dirt   orig_dir(    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyRª   y  s    

c         K   s]   t  i i ƒ  } t  i i | ƒ z |  ƒ  Wd x | D] } t  i | =q4 Wt  i i | ƒ Xd S(   s!   
    Invoke f in the context
    N(   R"   Ru   t   copyt   update(   Rd   t   updatest   old_envt   key(    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyR¨   †  s     c         C   s1   t  i } | t  i (z |  ƒ  Wd | t  i (Xd S(   s!   
    Invoke f in the context
    N(   R-   t   argv(   Rd   t   replt   old_argv(    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyR    “  s
    

c         C   s7   t  i i } d t  i _ z |  ƒ  Wd | t  i _ Xd S(   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	   distutilst   coret   _setup_stop_afterR}   (   Rd   t   setup_stop_after(    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyR’   ž  s
    (;   t   __doc__R-   R"   R'   R   t   unittestR^   t   setuptools.compatR    R   R   R   R   R»   t   distutils.coreRÑ   t   setuptools.sandboxR   R   t   setuptools.command.easy_installR   R   R   R	   t   setuptools.commandRY   t   setuptools.distR
   t   pkg_resourcesRI   t   setuptools.tests.serverR«   t
   __import__t   loggingt	   getLoggerRl   t   basicConfigt   INFOR‘   R6   Rk   t   ImportErrorR   R}   t   objectR   t
   executableR0   RT   t   TestCaseR   RE   RO   Rš   R   Rª   R¨   R    R’   (    (    (    s^   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/setuptools/tests/test_easy_install.pyt   <module>   sP   "

1™G			