;
Ñâ"Ic               @   sª   d  Z  d 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 e j d
 ƒ Z Gd „  d e	 ƒ Z d S(   uR   distutils.command.build_scripts

Implements the Distutils 'build_scripts' command.uC   $Id: build_scripts.py 61003 2008-02-23 18:30:17Z christian.heimes $i    N(   u   ST_MODE(   u	   sysconfig(   u   Command(   u   newer(   u   convert_path(   u   logu   ^#!.*python[0-9.]*([ 	].*)?$c             B   sY   |  Ee  Z d  Z d d d g Z d g Z d
 „  Z d „  Z d „  Z d „  Z d „  Z	 d S(   u(   "build" scripts (copy and fixup #! line)u
   build-dir=u   du   directory to "build" (copy) tou   forceu   fu1   forcibly build everything (ignore file timestampsu   executable=u   eu*   specify final destination interpreter pathc             C   s1   d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  S(   N(   u   Noneu	   build_diru   scriptsu   forceu
   executableu   outfiles(   u   self(    (    u<   /mit/python/lib/python3.0/distutils/command/build_scripts.pyu   initialize_options   s
    				c             C   s)   |  j  d d d d ƒ |  j j |  _ d  S(	   Nu   buildu   build_scriptsu	   build_diru   forceu
   executable(   u   build_scriptsu	   build_dir(   u   forceu   force(   u
   executableu
   executable(   u   set_undefined_optionsu   distributionu   scripts(   u   self(    (    u<   /mit/python/lib/python3.0/distutils/command/build_scripts.pyu   finalize_options&   s
    	c             C   s   |  j  S(   N(   u   scripts(   u   self(    (    u<   /mit/python/lib/python3.0/distutils/command/build_scripts.pyu   get_source_files-   s    c             C   s   |  j  p d  S|  j ƒ  d  S(   N(   u   scriptsu   copy_scripts(   u   self(    (    u<   /mit/python/lib/python3.0/distutils/command/build_scripts.pyu   run0   s    
c             C   së  |  j  |  j ƒ g  } x/|  j D]$} d } t | ƒ } t j j |  j t j j | ƒ ƒ } | j	 | ƒ |  j
 o( t | | ƒ o t j d | ƒ q  n y t | d ƒ } Wn+ t k
 o |  j p ‚  n d } Ync X| j ƒ  } | p |  j d | ƒ q  n t j | ƒ } | o  d } | j d ƒ p d } n | oÚ t j d | |  j ƒ |  j p¡ t | d ƒ }	 t j p |	 j d |  j | f ƒ nJ |	 j d t j j t j d	 ƒ d
 t j d ƒ t j d ƒ ƒ | f ƒ |	 j | j ƒ  ƒ |	 j  ƒ  n | o | j  ƒ  qDq  | o | j  ƒ  n |  j! | | ƒ q  Wt j" d k o xŒ | D]€ }
 |  j o t j d |
 ƒ q_t j# |
 ƒ t$ d @} | d Bd @} | | k o* t j d |
 | | ƒ t j% |
 | ƒ q_q_Wn d S(   u"  Copy each script listed in 'self.scripts'; if it's marked as a
        Python script in the Unix way (first line matches 'first_line_re',
        ie. starts with "\#!" and contains "python"), then adjust the first
        line to refer to the current Python interpreter as we copy.
        u   not copying %s (up-to-date)u   ru   %s is an empty file (skipping)i   u    u   copying and adjusting %s -> %su   wu   #!%s%s
u   BINDIRu   pythonu   VERSIONu   EXEu   posixu   changing mode of %siÿ  im  u!   changing mode of %s from %o to %oNFT(&   u   mkpathu	   build_diru   scriptsu   Falseu   convert_pathu   osu   pathu   joinu   basenameu   appendu   forceu   neweru   logu   debugu   openu   IOErroru   dry_runu   Noneu   readlineu   warnu   first_line_reu   matchu   Trueu   groupu   infou	   sysconfigu   python_buildu   writeu
   executableu   get_config_varu
   writelinesu	   readlinesu   closeu	   copy_fileu   nameu   statu   ST_MODEu   chmod(   u   selfu   outfilesu   scriptu   adjustu   outfileu   fu
   first_lineu   matchu   post_interpu   outfu   fileu   oldmodeu   newmode(    (    u<   /mit/python/lib/python3.0/distutils/command/build_scripts.pyu   copy_scripts6   sr    
 $



			  
	N(   u
   build-dir=u   du   directory to "build" (copy) to(   u   forceu   fu1   forcibly build everything (ignore file timestamps(   u   executable=u   eu*   specify final destination interpreter path(
   u   __name__u
   __module__u   descriptionu   user_optionsu   boolean_optionsu   initialize_optionsu   finalize_optionsu   get_source_filesu   runu   copy_scripts(   u
   __locals__(    (    u<   /mit/python/lib/python3.0/distutils/command/build_scripts.pyu   build_scripts   s   
						u   build_scripts(   u   __doc__u   __revision__u   osu   reu   statu   ST_MODEu	   distutilsu	   sysconfigu   distutils.coreu   Commandu   distutils.dep_utilu   neweru   distutils.utilu   convert_pathu   logu   compileu   first_line_reu   build_scripts(    (    (    u<   /mit/python/lib/python3.0/distutils/command/build_scripts.pyu   <module>   s   