ó
û_¾Tc           @   sŸ  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m	 Z	 m
 Z
 m Z d d l m Z d d l m	 Z d d l m Z d d l m Z yM d d l Z d d l Z e j d ƒ Z e j d	 e j d
 e j ƒ e Z Wn e k
 r&e Z d Z n Xd e f d „  ƒ  YZ  d e j! Z" d Z# d e j$ f d „  ƒ  YZ% d e j$ f d „  ƒ  YZ& d e j$ f d „  ƒ  YZ' d S(   s   Easy install Tests
iÿÿÿÿN(   t   StringIO(   t   easy_installt   get_script_argst   main(   t   PthDistributions(   R   (   t   Distributiont   test_easy_installt   levelt   streamt   FakeDistc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | d k r i  Si d d 6S(   Nt   console_scriptst   ept   name(    (   t   selft   group(    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   get_entry_map   s    c         C   s   d S(   Nt   spec(    (   R   (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   as_requirement   s    (   t   __name__t
   __module__R   R   (    (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/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')()
    )
s0   from setuptools import setup

setup(name='foo')
t   TestEasyInstallTestc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s„   t  ƒ  } t | ƒ } t | _ t j ƒ  | _ z? | j ƒ  t j	 j
 | j d ƒ } |  j t j	 j | ƒ ƒ Wd  t j | j ƒ Xd  S(   Ns   site.py(   R   R   t   Falset   sitepy_installedt   tempfilet   mkdtempt   install_dirt   install_site_pyt   ost   patht   joint   assert_t   existst   shutilt   rmtree(   R   t   distt   cmdt   sitepy(    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   test_install_site_py5   s    		
c         C   si   t  ƒ  } t j } z6 g  t | ƒ j ƒ  D] } | ^ q( d d !\ } } Wd  | t _ X|  j | t ƒ d  S(   Ni    i   (   R	   t   syst   platformR   t   nextt   assertEqualst   WANTED(   R   R"   t   old_platformt   iR   t   script(    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   test_get_script_argsA   s    		6
c         C   sí   t  j ƒ  } t t j j | d ƒ d ƒ } | j d ƒ | j ƒ  t t j j | d ƒ d ƒ } | j t ƒ | j ƒ  d d l	 m
 } d „  } | j | _ | | _ t j ƒ  } z t j | ƒ t g  ƒ Wd  t j | ƒ t j | ƒ Xd  S(   Ns	   setup.cfgt   ws.   [easy_install]
find_links = http://example.coms   setup.pyiÿÿÿÿ(   R   c         S   sA   d } |  j  } d | k r: d | d k s: t | ƒ ‚ n  |  j S(   Ns!   Error: a local setup.cfg was usedR   t
   find_links(   t   command_optionst   AssertionErrort   _old_parse_command_line(   R   t   msgt   opts(    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   _parse_command_lineZ   s
    	(   R   R   t   openR   R   R   t   writet   closet   SETUP_PYt   setuptools.distR   t   parse_command_lineR3   t   getcwdt   chdirR   R    R!   (   R   t   dirt	   setup_cfgt   setup_pyR   R6   t   old_wd(    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   test_no_setup_cfgL   s"    

		c         C   s  t  ƒ  } t | ƒ } d „  | _ t | _ d d g | _ t j j t	 j
 ƒ  d ƒ | _ d g | _ | j ƒ  |  j | j j i  ƒ t | ƒ } d „  | _ d d g | _ t j j t	 j
 ƒ  d ƒ | _ d g | _ | j ƒ  | j j j ƒ  } | j ƒ  |  j | d d g ƒ d  S(   Nc           S   s   t  S(   N(   t   True(    (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   <lambda>q   s    t   link1t   link2t   okc           S   s   t  S(   N(   RD   (    (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyRE   {   s    (   R   R   t   check_pth_processingRD   t   no_find_linksR0   R   R   R   R   R   R   t   argst   ensure_finalizedR)   t   package_indext   scanned_urlst   keyst   sort(   R   R"   R#   RO   (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   test_no_find_linksl   s$    		


(   R   R   R%   R.   RC   RQ   (    (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyR   3   s   			 t   TestPTHFileWriterc           B   s   e  Z d  „  Z d „  Z RS(   c         C   sV   t  d t j ƒ  g ƒ } |  j | j ƒ | j t t j ƒ  ƒ ƒ |  j | j ƒ 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   R=   R   t   dirtyt   addt   PRDistribution(   R   t   pth(    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt!   test_add_from_cwd_site_sets_dirty†   s    c         C   si   t  j d k r d } n d } t d | g ƒ } |  j | j ƒ | j t | ƒ ƒ |  j | j ƒ d  S(   Nt   nts%   /test/location/does-not-have-to-exists   c:\does_not_exists   does-not_exist(   R   R   R   R   RS   RT   RU   (   R   t   locationRV   (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   test_add_from_site_is_ignored   s    	(   R   R   RW   RZ   (    (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyRR   …   s   		t   TestUserInstallTestc           B   s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sÜ   t  j ƒ  |  _ t j j |  j d ƒ } t | d ƒ } | j t ƒ | j	 ƒ  t j
 ƒ  |  _ t j |  j ƒ t j d k rØ t j |  _ t j |  _ t j |  _ t  j ƒ  t _ t j |  _ t  j ƒ  t _ t j t _ n  d  S(   Ns   setup.pyR/   s   2.6(   R   R   R?   R   R   R   R7   R8   R:   R9   R=   t   old_cwdR>   R&   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/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   setUpœ   s    
c         C   s†   t  j |  j ƒ t j |  j ƒ t j d k r‚ t j t j	 ƒ t j t j
 ƒ |  j t _	 |  j t _
 |  j t _ |  j t _ n  d  S(   Ns   2.6(   R   R>   R\   R    R!   R?   R&   R]   Rc   Rd   Rf   Re   Rg   R`   R^   R_   Rb   Ra   (   R   (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   tearDown­   s    c         C   sg   t  t _ t j d k  r d  St ƒ  } d | _ t | ƒ } d g | _ | j	 ƒ  |  j
 | j d ƒ d  S(   Ns   2.6s   setup.pyt   pys   user should be implied(   RD   R^   R_   R&   R]   R   t   script_nameR   RK   RL   t
   assertTruet   user(   R   R"   R#   (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   test_user_install_implied¸   s    			
c         C   s   t  s
 d  St j d ƒ d  S(   Ns   this should not break(   t
   _MULTIPROCt   _LOGt   info(   R   (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   test_multiproc_atexitÄ   s    c         C   sg   t  t _ t j d k  r d  St ƒ  } d | _ t | ƒ } d g | _ | j	 ƒ  |  j
 | j d ƒ d  S(   Ns   2.6s   setup.pyRl   s   NOT user should be implied(   R   R^   R_   R&   R]   R   Rm   R   RK   t   initialize_optionst   assertFalseRo   (   R   R"   R#   (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt6   test_user_install_not_implied_without_usersite_enabledÉ   s    			
c   
      C   s´  t  j ƒ  } t  j ƒ  } t j j | d ƒ } t | d ƒ } y | j d ƒ Wn | j ƒ  n Xt j j	 | ƒ t j
 j d ƒ } t j j j t j ƒ t j
 d <zv t ƒ  } d | _ t | ƒ } | | _ d g | _ | j ƒ  | j j | g ƒ | j d ƒ } |  j | j | ƒ Wd  t j j | ƒ x[ | | g D]M }	 t j j |	 ƒ s8t j j |	 ƒ rjq8n  y t j |	 ƒ Wq8q8Xq8W| d  k	 r¥| t j
 d <n
 t j
 d =Xd  S(   Ns   foo-1.0.egg-infoR/   s
   Name: foo
t
   PYTHONPATHs   setup.pyt   foo(   R   R   R   R   R   R7   R8   R9   R&   t   appendt   environt   gett   pathsepR   Rm   R   R   RK   RL   t   local_indext   scanR)   RY   t   removeR   t   isdirR    R!   t   None(
   R   t   new_locationt   targett   egg_fileRi   t	   old_ppathR"   R#   t   rest   basedir(    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   test_local_indexÕ   s@    			
&(   R   R   Rj   Rk   Rp   Rt   Rw   R‰   (    (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyR[   š   s   					((   t   __doc__R&   R   R    R   t   unittestRc   R    t   setuptools.command.easy_installR   R   R   R   t   setuptools.commandR^   R;   R   t   pkg_resourcesRU   t   multiprocessingt   loggingt	   getLoggerRr   t   basicConfigt   INFOt   stderrRD   Rq   t   ImportErrorR   R‚   t   objectR	   t
   executableR*   R:   t   TestCaseR   RR   R[   (    (    (    s„   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_easy_install.pyt   <module>   s0   0

R