Ñò
ïžòKc           @   s  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 Z d d k	 l
 Z
 d e i i f d „  ƒ  YZ d e i i f d „  ƒ  YZ d e i f d	 „  ƒ  YZ d
 e i f d „  ƒ  YZ d „  Z e d j o e i d d ƒ n d S(   s   Tests for distutils.dist.iÿÿÿÿN(   t   TESTFNt	   test_distc           B   s    e  Z d  Z d g Z d „  Z RS(   s#   Sample distutils extension command.s   sample-option=t   Ss	   help textc         C   s   d  |  _ d  S(   N(   t   Nonet   sample_option(   t   self(    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   initialize_options   s    (   s   sample-option=R   s	   help text(   t   __name__t
   __module__t   __doc__t   user_optionsR   (    (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyR      s   	t   TestDistributionc           B   s   e  Z d  Z d „  Z RS(   s²   Distribution subclasses that avoids the default search for
    configuration files.

    The ._config_files attribute must be set before
    .parse_config_files() is called.
    c         C   s   |  i  S(   N(   t   _config_files(   R   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   find_config_files#   s    (   R   R   R	   R   (    (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyR      s   t   DistributionTestCasec           B   sS   e  Z d  „  Z d „  Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(	   c         C   s   t  i |  _ t  i d 3d  S(   Ni   (   t   syst   argv(   R   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   setUp)   s    c         C   s   |  i  t i  (d  S(   N(   R   R   (   R   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   tearDown-   s    c         C   s*   t  ƒ  } | | _ | i ƒ  | i ƒ  | S(   N(   R   R   t   parse_config_filest   parse_command_line(   R   t   configfilest   d(    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   create_distribution0   s
    		

c         C   s9   t  i i d ƒ |  i ƒ  } |  i | i ƒ  d g ƒ d  S(   Nt   builds   distutils.command(   R   R   t   appendR   t   assertEqualt   get_command_packages(   R   R   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt!   test_command_packages_unspecified7   s    c         C   s“   d d k  l } t i i d d d d g ƒ |  i ƒ  } |  i | i ƒ  d d d	 g ƒ | i d ƒ } |  i	 t
 | | ƒ ƒ |  i | i d
 ƒ d  S(   Niÿÿÿÿ(   R   s   --command-packagess   foo.bar,distutils.testsR   s
   -Ssometexts   distutils.commands   foo.bars   distutils.testst   sometext(   t   distutils.tests.test_distR   R   R   t   extendR   R   R   t   get_command_objt   assert_t
   isinstanceR   (   R   R   R   t   cmd(    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   test_command_packages_cmdline<   s    
c         C   s  t  i i d ƒ t t d ƒ } zØ | d IJ| d IJ| i ƒ  |  i t g ƒ } |  i | i ƒ  d d d g ƒ d d	 d g t  i d
 )|  i t g ƒ } |  i | i ƒ  d d	 g ƒ d d d g t  i d
 )|  i t g ƒ } |  i | i ƒ  d g ƒ Wd  t	 i
 t ƒ Xd  S(   NR   t   ws   [global]s!   command_packages = foo.bar, splats   distutils.commands   foo.bart   splats   --command-packagest   sporki   t    (   R   R   R   t   openR    t   closeR   R   R   t   ost   unlink(   R   t   fR   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt    test_command_packages_configfileK   s"    


c      
   C   s  t  i i t  i i t ƒ d ƒ } t i i } | d h d d 6d d 6d d 6d	 d
 6d d 6ƒ } z | i i	 t
 | d ƒ ƒ Wd  t  i i | ƒ o t  i | ƒ n X| d h d d 6d d 6d d 6d d
 6d d 6ƒ } z | i i	 t
 | d ƒ ƒ Wd  t  i i | ƒ o t  i | ƒ n Xd  S(   NR-   t   attrsu   Mister CafÃ©t   authors
   my.packaget   nameu   CafÃ© Juniort
   maintaineru   CafÃ© torrÃ©fiÃ©t   descriptionu	   HÃ©hÃ©hÃ©t   long_descriptionR%   s   Mister Cafes   Cafe Juniors   Cafe torrefiet   Hehehe(   R+   t   patht   joint   dirnamet   __file__t	   distutilst   distt   Distributiont   metadatat   write_pkg_fileR)   t   existst   remove(   R   t   my_filet   klassR;   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   test_write_pkg_filee   s(    !c      	      s�   t  i i } g  ‰  ‡  f d †  } t i } | t _ z6 | d h d d 6d d 6d d 6d d 6h  d	 6ƒ } Wd  | t _ X|  i t ˆ  ƒ d
 ƒ d  S(   Nc            s   ˆ  i  |  ƒ d  S(   N(   R   (   t   msg(   t   warns(    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   _warnŽ   s    R/   t   xxxR0   R1   t   versiont   xxxxt   urlt   optionsi    (   R:   R;   R<   t   warningst   warnt   assertEqualst   len(   R   RB   RF   t   old_warnR;   (    (   RE   s/   scripts/common/Lib/distutils/tests/test_dist.pyt   test_empty_options‡   s    		
(    (
   R   R   R   R   R   R   R$   R.   RC   RQ   (    (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyR   '   s   						"t   MetadataTestCasec           B   sY   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   c         C   s—   h d d 6d d 6} t  i i | ƒ } |  i | ƒ } |  i d | j ƒ |  i d | i ƒ  j ƒ |  i d | i ƒ  j ƒ |  i d | i ƒ  j ƒ d  S(	   Nt   packageR1   s   1.0RH   s   Metadata-Version: 1.0s	   provides:s	   requires:s
   obsoletes:(   R:   R;   R<   t   format_metadataR!   t   lower(   R   R/   R;   t   meta(    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   test_simple_metadata    s    

c         C   sÆ   h d d 6d d 6d d g d 6} t  i i | ƒ } |  i | i i ƒ  d d g ƒ |  i | i ƒ  d d g ƒ |  i | ƒ } |  i d | j ƒ |  i d | i ƒ  j ƒ |  i d	 | i ƒ  j ƒ d  S(
   NRS   R1   s   1.0RH   s   package.subt   providess   Metadata-Version: 1.1s	   requires:s
   obsoletes:(	   R:   R;   R<   R   R=   t   get_providesRT   R!   RU   (   R   R/   R;   RV   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   test_providesª   s    
c         C   s5   |  i  t t i i h d d 6d d 6d g d 6ƒ d  S(   NRS   R1   s   1.0RH   s   my.pkg (splat)RX   (   t   assertRaisest
   ValueErrorR:   R;   R<   (   R   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   test_provides_illegal¸   s
    		
c         C   sì   h d d 6d d 6d d g d 6} t  i i | ƒ } |  i | i i ƒ  d d g ƒ |  i | i ƒ  d d g ƒ |  i | ƒ } |  i d | j ƒ |  i d	 | i ƒ  j ƒ |  i d
 | j ƒ |  i d | j ƒ |  i d | i ƒ  j ƒ d  S(   NRS   R1   s   1.0RH   t   others   another (==1.0)t   requiress   Metadata-Version: 1.1s	   provides:s   Requires: others   Requires: another (==1.0)s
   obsoletes:(	   R:   R;   R<   R   R=   t   get_requiresRT   R!   RU   (   R   R/   R;   RV   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   test_requires¿   s    
c         C   s5   |  i  t t i i h d d 6d d 6d g d 6ƒ d  S(   NRS   R1   s   1.0RH   s   my.pkg (splat)R_   (   R[   R\   R:   R;   R<   (   R   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   test_requires_illegalÏ   s
    		
c         C   sì   h d d 6d d 6d d g d 6} t  i i | ƒ } |  i | i i ƒ  d d g ƒ |  i | i ƒ  d d g ƒ |  i | ƒ } |  i d | j ƒ |  i d	 | i ƒ  j ƒ |  i d
 | i ƒ  j ƒ |  i d | j ƒ |  i d | j ƒ d  S(   NRS   R1   s   1.0RH   R^   s   another (<1.0)t	   obsoletess   Metadata-Version: 1.1s	   provides:s	   requires:s   Obsoletes: others   Obsoletes: another (<1.0)(	   R:   R;   R<   R   R=   t   get_obsoletesRT   R!   RU   (   R   R/   R;   RV   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   test_obsoletesÖ   s    
c         C   s5   |  i  t t i i h d d 6d d 6d g d 6ƒ d  S(   NRS   R1   s   1.0RH   s   my.pkg (splat)Rc   (   R[   R\   R:   R;   R<   (   R   (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   test_obsoletes_illegalæ   s
    		
c         C   s&   t  i  ƒ  } | i i | ƒ | i ƒ  S(   N(   t   StringIOR=   R>   t   getvalue(   R   R;   t   sio(    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyRT   í   s    c   
   
   C   s®  h  } xE d D]= } t  i i | ƒ } | | | <| d  j	 o t  i | =q q Wt  i d j o
 d } n d } t  i i t ƒ } t  i i | | ƒ } t	 | d ƒ } | i
 d ƒ | i ƒ  z  t i i ƒ  } t i d j o0 | t  i d <| i ƒ  } |  i | | j ƒ n t i d j o= | t  i d <| i ƒ  } |  i | | j d | | f ƒ n Wd  x; | i ƒ  D]- \ }	 } | d  j o qkn | t  i |	 <qkWt  i | ƒ Xd  S(   Nt   HOMEt   HOMEPATHt	   HOMEDRIVEt   posixs   .pydistutils.cfgs   pydistutils.cfgR%   t   .t   linuxt   darwint   win32s   %r not found in %r(   s   HOMEs   HOMEPATHs	   HOMEDRIVE(   s   linuxs   darwin(   R+   t   environt   getR   R1   R6   R8   R9   R7   R)   t   writeR*   R:   R;   R<   R   t   platformR   R!   t   itemsR@   (
   R   t   oldt   envt   valuet   user_filenamet   curdirR-   R;   t   filest   key(    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   test_custom_pydistutilsò   s@     


 (   R   R   RW   RZ   R]   Ra   Rb   Re   Rf   RT   R~   (    (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyRR   ž   s   	
							c          C   s<   t  i ƒ  }  |  i t  i t ƒ ƒ |  i t  i t ƒ ƒ |  S(   N(   t   unittestt	   TestSuitet   addTestt	   makeSuiteR   RR   (   t   suite(    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt
   test_suite  s    t   __main__t   defaultTestR„   (   R	   t   distutils.cmdR:   t   distutils.distR+   Rg   R   R   RL   t   test.test_supportR    R#   t   CommandR   R;   R<   R   t   TestCaseR   RR   R„   R   t   main(    (    (    s/   scripts/common/Lib/distutils/tests/test_dist.pyt   <module>   s   w€	