ó
Š]c           @   s¸   d  Z  d d l Z d d l Z d d l m Z d d l m Z d d l Z d d l m	 Z	 d d l
 m 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.build_scripts.iÿÿÿÿN(   t   build_scripts(   t   Distribution(   t   support(   t   run_unittestt   BuildScriptsTestCasec           B   s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sc   |  j  d g  ƒ } |  j | j ƒ |  j | j ƒ | j ƒ  |  j | j ƒ |  j | j d ƒ d  S(   Ns   /foo/bar(   t   get_build_scripts_cmdt   assertFalset   forcet   assertIsNonet	   build_dirt   finalize_optionst
   assertTruet   assertEqual(   t   selft   cmd(    (    s3   lib/python2.7/distutils/tests/test_build_scripts.pyt   test_default_settings   s    
c         C   s£   |  j  ƒ  } |  j  ƒ  } |  j | ƒ } |  j | g  | D] } t j j | | ƒ ^ q7 ƒ } | j ƒ  | j ƒ  t j | ƒ } x | D] } |  j	 | | ƒ q… Wd  S(   N(
   t   mkdtempt   write_sample_scriptsR   t   ost   patht   joinR
   t   runt   listdirt   assertIn(   R   t   sourcet   targett   expectedt   fnR   t   builtt   name(    (    s3   lib/python2.7/distutils/tests/test_build_scripts.pyt
   test_build   s    	(

c         C   sP   d d  l  } t ƒ  } | | _ t j d | d d d | j ƒ | j d <t | ƒ S(   NiÿÿÿÿR    R   i   t
   executablet   build(   t   sysR   t   scriptsR   t   DummyCommandR   t   command_objR    (   R   R   R"   R!   t   dist(    (    s3   lib/python2.7/distutils/tests/test_build_scripts.pyR   +   s    			c         C   sj   g  } | j  d ƒ |  j | d d ƒ | j  d ƒ |  j | d d ƒ | j  d ƒ |  j | d d ƒ | S(   Ns
   script1.pys@   #! /usr/bin/env python2.3
# bogus script w/ Python sh-bang
pass
s
   script2.pys8   #!/usr/bin/python
# bogus script w/ Python sh-bang
pass
s   shell.shs1   #!/bin/sh
# bogus shell script w/ sh-bang
exit 0
(   t   appendt   write_script(   R   t   dirR   (    (    s3   lib/python2.7/distutils/tests/test_build_scripts.pyR   6   s    c         C   sA   t  t j j | | ƒ d ƒ } z | j | ƒ Wd  | j ƒ  Xd  S(   Nt   w(   t   openR   R   R   t   writet   close(   R   R(   R   t   textt   f(    (    s3   lib/python2.7/distutils/tests/test_build_scripts.pyR'   I   s    c   	      C   sé   |  j  ƒ  } |  j  ƒ  } |  j | ƒ } |  j | g  | D] } t j j | | ƒ ^ q7 ƒ } | j ƒ  t j ƒ  j	 d ƒ } d t j
 d <z | j ƒ  Wd  | d  k	 r´ | t j
 d <n  Xt j | ƒ } x | D] } |  j | | ƒ qË Wd  S(   Nt   VERSIONi   (   R   R   R   R   R   R   R
   t	   sysconfigt   get_config_varst   gett   _CONFIG_VARSR   t   NoneR   R   (	   R   R   R   R   R   R   t   oldR   R   (    (    s3   lib/python2.7/distutils/tests/test_build_scripts.pyt   test_version_intP   s     	(
(   t   __name__t
   __module__R   R   R   R   R'   R6   (    (    (    s3   lib/python2.7/distutils/tests/test_build_scripts.pyR      s   	
				c           C   s   t  j t ƒ S(   N(   t   unittestt	   makeSuiteR   (    (    (    s3   lib/python2.7/distutils/tests/test_build_scripts.pyt
   test_suitel   s    t   __main__(   t   __doc__R   R9   t   distutils.command.build_scriptsR    t   distutils.coreR   R0   t   distutils.testsR   t   test.test_supportR   t   TempdirManagert   LoggingSilencert   TestCaseR   R;   R7   (    (    (    s3   lib/python2.7/distutils/tests/test_build_scripts.pyt   <module>   s   	\	