ó
§xxTc           @   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 m Z d d l m	 Z	 d d l
 m Z d d l m Z d d l m Z d d l m Z d d	 l m Z d
 Z d e j e j e j f d „  ƒ  YZ d „  Z e d k re e ƒ  ƒ n  d S(   s&   Tests for distutils.command.bdist_rpm.iÿÿÿÿN(   t   run_unittest(   t   Distribution(   t	   bdist_rpm(   t   support(   t   find_executable(   t   spawn(   t   DistutilsExecErrors–   from distutils.core import setup
import foo

setup(name='foo', version='0.1', py_modules=['foo'],
      url='xxx', author='xxx', author_email='xxx')

t   BuildRpmTestCasec           B   sà   e  Z d  „  Z d „  Z e j e j j d ƒ d ƒ e j	 e
 d ƒ d
 k d ƒ e j	 e
 d ƒ d
 k d ƒ d „  ƒ ƒ ƒ Z e j e j j d ƒ d ƒ e j	 e
 d ƒ d
 k d ƒ e j	 e
 d ƒ d
 k d ƒ d	 „  ƒ ƒ ƒ Z RS(   c         C   s<   t  t |  ƒ j ƒ  t j ƒ  |  _ t j t j f |  _ d  S(   N(	   t   superR   t   setUpt   ost   getcwdt   old_locationt   syst   argvt   old_sys_argv(   t   self(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/distutils/tests/test_bdist_rpm.pyR	      s    c         C   sH   t  j |  j ƒ |  j d t _ |  j d t j (t t |  ƒ j ƒ  d  S(   Ni    i   (	   R
   t   chdirR   R   R   R   R   R   t   tearDown(   R   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/distutils/tests/test_bdist_rpm.pyR   $   s    t   linuxs,   spurious sdtout/stderr output under Mac OS Xt   rpms   the rpm command is not foundt   rpmbuilds!   the rpmbuild command is not foundc         C   sk  |  j  ƒ  } t j j | d ƒ } t j | ƒ |  j | d f t ƒ |  j | d f d ƒ |  j | d f d ƒ |  j | d f d ƒ t i d d	 6d
 d 6d g d 6d d 6d d 6d d 6ƒ } d | _ t j	 | ƒ d g t
 _ t | ƒ } t | _ d | _ | j ƒ  | j ƒ  t j t j j | d ƒ ƒ } |  j d | ƒ |  j d | j ƒ |  j d | j ƒ d  S(   Nt   foos   setup.pys   foo.pyt   #s   MANIFEST.ins   include foo.pyt   READMEt    t   names   0.1t   versiont
   py_modulest   xxxt   urlt   authort   author_emaili   t   dists   foo-0.1-1.noarch.rpmR   t   anys   dist/foo-0.1-1.src.rpms   dist/foo-0.1-1.noarch.rpm(   s	   bdist_rpms   anys   dist/foo-0.1-1.src.rpm(   s	   bdist_rpms   anys   dist/foo-0.1-1.noarch.rpm(   t   mkdtempR
   t   patht   joint   mkdirt
   write_filet   SETUP_PYR   t   script_nameR   R   R   R   t   Truet
   fix_pythont   quiett   ensure_finalizedt   runt   listdirt   assertInt
   dist_files(   R   t   tmp_dirt   pkg_dirR!   t   cmdt   dist_created(    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/distutils/tests/test_bdist_rpm.pyt
   test_quiet,   s.    
			

c         C   sŠ  |  j  ƒ  } t j j | d ƒ } t j | ƒ |  j | d f t ƒ |  j | d f d ƒ |  j | d f d ƒ |  j | d f d ƒ t i d d	 6d
 d 6d g d 6d d 6d d 6d d 6ƒ } d | _ t j	 | ƒ d g t
 _ t | ƒ } t | _ d | _ | j ƒ  | j ƒ  t j t j j | d ƒ ƒ } |  j d | ƒ |  j d | j ƒ |  j d | j ƒ t j t j j | d d ƒ ƒ d  S(   NR   s   setup.pys   foo.pyR   s   MANIFEST.ins   include foo.pyR   R   R   s   0.1R   R   R   R   R   R    i   R!   s   foo-0.1-1.noarch.rpmR   R"   s   dist/foo-0.1-1.src.rpms   dist/foo-0.1-1.noarch.rpm(   s	   bdist_rpms   anys   dist/foo-0.1-1.src.rpm(   s	   bdist_rpms   anys   dist/foo-0.1-1.noarch.rpm(   R#   R
   R$   R%   R&   R'   R(   R   R)   R   R   R   R   R*   R+   R,   R-   R.   R/   R0   R1   t   remove(   R   R2   R3   R!   R4   R5   (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/distutils/tests/test_bdist_rpm.pyt   test_no_optimize_flagU   s0    	
			

N(   t   __name__t
   __module__R	   R   t   unittestt
   skipUnlessR   t   platformt
   startswitht   skipIfR   t   NoneR6   R8   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/distutils/tests/test_bdist_rpm.pyR      s   		$c           C   s   t  j t ƒ S(   N(   R;   t	   makeSuiteR   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/distutils/tests/test_bdist_rpm.pyt
   test_suite~   s    t   __main__(   t   __doc__R;   R   R
   t   tempfilet   shutilt   test.test_supportR    t   distutils.coreR   t   distutils.command.bdist_rpmR   t   distutils.testsR   t   distutils.spawnR   t	   distutilsR   t   distutils.errorsR   R(   t   TempdirManagert   LoggingSilencert   TestCaseR   RB   R9   (    (    (    sJ   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/distutils/tests/test_bdist_rpm.pyt   <module>   s&   		a	