Ńņ
ļņKc           @   sŁ  d  Z  d d k l Z d Z d d k Z d d k Z d d k Z d d k Td d k l	 Z	 d d k
 l Z d d k l Z d d	 k l Z d d
 k l Z d d k l Z l Z l Z d d k l Z d d k l Z d d k l Z d d k l Z e i d j  o- h d d 6d d 6d d 6d d 6d d 6Z n* h d d 6d d 6d d 6d d 6d d 6Z h	 h d d 6d d 6d d 6d d 6d d 6d 6h d d 6d d 6d  d 6d d 6d d 6d! 6h d" d 6d" d 6d# d 6d$ d 6d% d 6d& 6e d' 6h d" d 6d" d 6d( d 6d) d 6d% d 6d* 6h d d 6d d 6d d 6d d 6d d 6d+ 6h d" d 6d" d 6d, d 6d$ d 6d% d 6d- 6h d d 6d d 6d d 6d d 6d d 6d. 6h d" d 6d" d 6d# d 6d$ d 6d% d 6d/ 6Z d2 Z d0 e	 f d1     YZ d S(3   sF   distutils.command.install

Implements the Distutils 'install' command.i’’’’(   t   logs=   $Id: install.py 62788 2008-05-06 22:41:46Z christian.heimes $N(   t   *(   t   Command(   t   DEBUG(   t   get_config_vars(   t   DistutilsPlatformError(   t
   write_file(   t   convert_patht
   subst_varst   change_root(   t   get_platform(   t   DistutilsOptionError(   t	   USER_BASE(   t	   USER_SITEs   2.2s   $baset   purelibt   platlibs   $base/Include/$dist_namet   headerss   $base/Scriptst   scriptst   datas   $base/Lib/site-packagess/   $base/lib/python$py_version_short/site-packagess3   $platbase/lib/python$py_version_short/site-packagess0   $base/include/python$py_version_short/$dist_names	   $base/bint   unix_prefixs   $base/lib/pythons   $base/include/python/$dist_namet	   unix_homes	   $usersites4   $userbase/include/python$py_version_short/$dist_names   $userbase/bins	   $userbaset	   unix_usert   nts4   $userbase/Python$py_version_nodot/Include/$dist_names   $userbase/Scriptst   nt_usert   macs.   $userbase/$py_version_short/include/$dist_namet   mac_usert   os2t   os2_homet   installc           B   s  e  Z d  Z dH dI dJ d dG d e f dK d dG d d f dL dM dN d dG d d f dO dP dQ dR dS dT dU dV dW g Z d d% d( d g Z h d d  6Z d,   Z d-   Z	 d.   Z
 d/   Z d0   Z d1   Z d2   Z d3   Z d4   Z d5   Z d6   Z d7   Z d8   Z d9   Z d:   Z d;   Z d<   Z d=   Z d>   Z d?   Z d@   Z dA e f dB e f dC e f dD e f dE dF   f g Z RS(X   s'   install everything from build directorys   prefix=s   installation prefixs   exec-prefix=s.   (Unix only) prefix for platform-specific filess   home=s+   (Unix only) home directory to install undert   users!   install in user site-package '%s's   install-base=s;   base installation directory (instead of --prefix or --home)s   install-platbase=s8   base installation directory for platform-specific files s$   (instead of --exec-prefix or --home)s   root=s<   install everything relative to this alternate root directorys   install-purelib=s;   installation directory for pure Python module distributionss   install-platlib=s8   installation directory for non-pure module distributionss   install-lib=s4   installation directory for all module distributions s3   (overrides --install-purelib and --install-platlib)s   install-headers=s(   installation directory for C/C++ headerss   install-scripts=s)   installation directory for Python scriptss   install-data=s%   installation directory for data filest   compilet   cs   compile .py to .pyc [default]s
   no-compiles   don't compile .py filess	   optimize=t   Osl   also compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]t   forcet   fs1   force installation (overwrite any existing files)s
   skip-builds2   skip rebuilding everything (for testing/debugging)s   record=s3   filename in which to record list of installed filesc         C   så   d  |  _ d  |  _ d  |  _ d |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _	 d  |  _
 d  |  _ d  |  _ d  |  _ t |  _ t |  _ d  |  _ d  |  _ d  |  _ d |  _ d |  _ d |  _ d |  _ d  |  _ d  |  _ d  |  _ d  S(   Ni    i   (   t   Nonet   prefixt   exec_prefixt   homeR   t   install_baset   install_platbaset   roott   install_purelibt   install_platlibt   install_headerst   install_libt   install_scriptst   install_dataR   t   install_userbaseR   t   install_usersiteR   t   optimizet
   extra_patht   install_path_fileR!   t
   skip_buildt   warn_dirt
   build_baset	   build_libt   record(   t   self(    (    s/   scripts/common/Lib/distutils/command/install.pyt   initialize_options±   s2    																	
							c         C   sm  |  i  p |  i p
 |  i o% |  i p
 |  i o t d d  n |  i o! |  i  p
 |  i o t d  n |  i oB |  i  p( |  i p |  i p |  i p
 |  i o t d   n t i d j o( |  i o |  i	 d  d  |  _ qņ n |  i d  t i d j o |  i   n |  i   |  i d  t i t i  d	 } t d
 d  \ } } h |  i i   d 6|  i i   d 6|  i i   d 6| d 6| d	 d !d 6| d	 | d d 6| d 6| d
 6| d 6| d 6|  i d 6|  i d 6|  _ |  i   |  i d  |  i |  i d <|  i |  i d <t o& d d k l } d GH| |  i  n |  i   |  i d  |  i o |  i   n |  i d  j o- |  i i  o |  i! |  _ qĄ|  i" |  _ n |  i# d d  d! d" d# d$ d d  |  i$   |  i |  _% t i& i' |  i |  i(  |  _ |  i) d  j	 o# |  i* d% d d  d! d" d# d$  n |  i d&  |  i+ d' d* d+  d  S(,   Ns.   must supply either prefix/exec-prefix/home or s)   install-base/install-platbase -- not boths9   must supply either home or prefix/exec-prefix -- not bothsJ   can't combine user with with prefix/exec_prefix/home or install_(plat)baset   posixs+   exec-prefix option ignored on this platforms   pre-finalize_{unix,other}s   post-finalize_{unix,other}()i    R$   R%   t	   dist_namet   dist_versiont   dist_fullnamet
   py_versioni   t   py_version_shorti   t   py_version_nodott
   sys_prefixt   sys_exec_prefixt   userbaset   usersites   post-expand_basedirs()t   baset   platbasei’’’’(   t   pprints   config vars:s   post-expand_dirs()t   libR   R   R   R   R   t   libbases   after prepending roott   buildR7   R8   (   s
   build_bases
   build_base(   s	   build_libs	   build_lib(,   R$   R%   R&   R'   R(   R   R   t   ost   namet   warnR#   t	   dump_dirst   finalize_unixt   finalize_othert   stringt   splitt   syst   versionR   t   distributiont   get_namet   get_versiont   get_fullnameR0   R1   t   config_varst   expand_basedirsR   RI   t   expand_dirst   create_home_pathR-   t   ext_modulesR+   R*   t   convert_pathst   handle_extra_patht   install_libbaset   patht   joint
   extra_dirsR)   t   change_rootst   set_undefined_options(   R:   R@   R$   R%   RI   (    (    s/   scripts/common/Lib/distutils/command/install.pyt   finalize_optionsž   s~    
(






	

	c         C   sÕ   t  oŹ d d k l } | d GHx® |  i D] } | d } | d d j o | d d !} n | |  i j o- t i |  i | |  } t |  |  } n" t i | |  } t |  |  } d | | f GHq* Wn d  S(   Ni’’’’(   t   longopt_xlatet   :i    t   =s     %s: %s(   R   t   distutils.fancy_getoptRi   t   user_optionst   negative_optRS   t	   translatet   getattr(   R:   t   msgRi   t   optt   opt_namet   val(    (    s/   scripts/common/Lib/distutils/command/install.pyRP     s    	
 
	c         C   s¾  |  i  d  j	 p |  i d  j	 or |  i d  j o  |  i d  j o |  i d  j p0 |  i d  j p  |  i d  j p |  i d  j o t	 d  n d  S|  i
 oD |  i d  j o t d   n |  i |  _  |  _ |  i d  nŪ |  i d  j	 o$ |  i |  _  |  _ |  i d  n§ |  i d  j oQ |  i d  j	 o t	 d  n t i i t i  |  _ t i i t i  |  _ n! |  i d  j o |  i |  _ n |  i |  _  |  i |  _ |  i d  d  S(   NsP   install-base or install-platbase supplied, but installation scheme is incompletes$   User base directory is not specifiedR   R   s*   must not supply exec-prefix without prefixR   (   R'   R#   R(   R-   R*   R+   R,   R.   R/   R   R   R0   R   t   select_schemeR&   R$   R%   RM   Rc   t   normpathRU   (   R:   (    (    s/   scripts/common/Lib/distutils/command/install.pyRQ     s<     


c         C   s  |  i  oK |  i d  j o t d   n |  i |  _ |  _ |  i t i d  n® |  i	 d  j	 o$ |  i	 |  _ |  _ |  i d  nz |  i
 d  j o t i i t i
  |  _
 n |  i
 |  _ |  _ y |  i t i  Wn# t j
 o t d t i  n Xd  S(   Ns$   User base directory is not specifiedt   _userR   s)   I don't know how to install stuff on '%s'(   R   R0   R#   R   R'   R(   Ru   RM   RN   R&   R$   Rc   Rv   RU   t   KeyError(   R:   (    (    s/   scripts/common/Lib/distutils/command/install.pyRR   É  s"    
c         C   sW   t  | } xF t D]> } d | } t |  |  d  j o t |  | | |  q q Wd  S(   Nt   install_(   t   INSTALL_SCHEMESt   SCHEME_KEYSRp   R#   t   setattr(   R:   RN   t   schemet   keyt   attrname(    (    s/   scripts/common/Lib/distutils/command/install.pyRu   ā  s    
 
c         C   s   x | D]~ } t  |  |  } | d  j	 o\ t i d j p t i d j o t i i |  } n t | |  i  } t |  | |  q q Wd  S(   NR<   R   (	   Rp   R#   RM   RN   Rc   t
   expanduserR   R[   R|   (   R:   t   attrst   attrRt   (    (    s/   scripts/common/Lib/distutils/command/install.pyt   _expand_attrsė  s      c         C   s   |  i  d d d g  d  S(   NR'   R(   R)   (   R   (   R:   (    (    s/   scripts/common/Lib/distutils/command/install.pyR\   õ  s    	c         C   s#   |  i  d d d d d d g  d  S(   NR*   R+   R-   R,   R.   R/   (   R   (   R:   (    (    s/   scripts/common/Lib/distutils/command/install.pyR]   ś  s    	c         G   s>   x7 | D]/ } d | } t  |  | t t |  |    q Wd  S(   NRy   (   R|   R   Rp   (   R:   t   namesRN   R   (    (    s/   scripts/common/Lib/distutils/command/install.pyR`     s     
c         C   sō   |  i  d  j o |  i i  |  _  n |  i  d  j	 o t |  i   t j o t i |  i  d  |  _  n t |  i   d j o |  i  d } } n3 t |  i   d j o |  i  \ } } n
 t d  t	 |  } n d  } d } | |  _
 | |  _ d  S(   Nt   ,i   i    i   sY   'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementst    (   R3   R#   RW   t   typet
   StringTypeRS   RT   t   lenR   R   t	   path_fileRe   (   R:   R   Re   (    (    s/   scripts/common/Lib/distutils/command/install.pyRa   	  s     	c      	   G   sD   x= | D]5 } d | } t  |  | t |  i t |  |    q Wd  S(   NRy   (   R|   R	   R)   Rp   (   R:   R   RN   R   (    (    s/   scripts/common/Lib/distutils/command/install.pyRf   +  s     
c         C   s   |  i  p d St t i i d   } xf |  i i   D]U \ } } | i |  o9 t i i |  o% |  i	 d |  t i
 | d  q7 q7 Wd S(   s#   Create directories under ~
        Nt   ~s   os.makedirs('%s', 0700)iĄ  (   R   R   RM   Rc   R   R[   t	   iteritemst
   startswitht   isdirt   debug_printt   makedirs(   R:   R&   RN   Rc   (    (    s/   scripts/common/Lib/distutils/command/install.pyR^   0  s    
 $c      	   C   s“  |  i  pP |  i d  |  i i d  i } |  i o  | t   j o t d   qZ n x! |  i   D] } |  i |  qg W|  i	 o |  i
   n |  i o |  i   } |  i oB t |  i  } x0 t t |   D] } | | | | | <qŲ Wn |  i t |  i | f d |  i  n t t i i t i  } t t i i |  } t i i t i i |  i   } |  i o9 |  i	 o |  i o$ | | j o t i d |  i  n d  S(   NRL   s"   Can't install when cross-compilings'   writing list of installed files to '%s's   modules installed to '%s', which is not in Python's module search path (sys.path) -- you'll have to change the search path yourself(   R5   t   run_commandRW   t   get_command_objt	   plat_nameR6   R
   R   t   get_sub_commandsR   t   create_path_fileR9   t   get_outputsR)   R   t   xranget   executeR   t   mapRM   Rc   Rv   RU   t   normcaseR-   R4   R    t   debug(   R:   t
   build_platt   cmd_namet   outputst   root_lent   countert   sys_pathR-   (    (    s/   scripts/common/Lib/distutils/command/install.pyt   run=  s:    
 


 	!
	c         C   se   t  i i |  i |  i d  } |  i o' |  i t | |  i g f d |  n |  i	 d |  d  S(   Ns   .pths   creating %ss   path file '%s' not created(
   RM   Rc   Rd   Rb   R   R4   R   R   Re   RO   (   R:   t   filename(    (    s/   scripts/common/Lib/distutils/command/install.pyR   k  s    
	c         C   s£   g  } xX |  i    D]J } |  i |  } x2 | i   D]$ } | | j o | i |  q5 q5 Wq W|  i o4 |  i o* | i t i i |  i	 |  i d   n | S(   Ns   .pth(
   R   t   get_finalized_commandR   t   appendR   R4   RM   Rc   Rd   Rb   (   R:   R   R   t   cmdR£   (    (    s/   scripts/common/Lib/distutils/command/install.pyR   x  s      c         C   sC   g  } x6 |  i    D]( } |  i |  } | i | i    q W| S(   N(   R   R¤   t   extendt
   get_inputs(   R:   t   inputsR   R¦   (    (    s/   scripts/common/Lib/distutils/command/install.pyRØ     s     c         C   s   |  i  i   p |  i  i   S(   sR   Return true if the current distribution has any Python
        modules to install.(   RW   t   has_pure_modulest   has_ext_modules(   R:   (    (    s/   scripts/common/Lib/distutils/command/install.pyt   has_lib  s    c         C   s   |  i  i   S(   N(   RW   t   has_headers(   R:   (    (    s/   scripts/common/Lib/distutils/command/install.pyR­     s    c         C   s   |  i  i   S(   N(   RW   t   has_scripts(   R:   (    (    s/   scripts/common/Lib/distutils/command/install.pyR®     s    c         C   s   |  i  i   S(   N(   RW   t   has_data_files(   R:   (    (    s/   scripts/common/Lib/distutils/command/install.pyt   has_data”  s    R-   R,   R.   R/   t   install_egg_infoc         C   s   t  S(    (   t   True(   R:   (    (    s/   scripts/common/Lib/distutils/command/install.pyt   <lambda>«  s    N(   s   prefix=Ns   installation prefix(   s   exec-prefix=Ns.   (Unix only) prefix for platform-specific files(   s   home=Ns+   (Unix only) home directory to install under(   s   install-base=Ns;   base installation directory (instead of --prefix or --home)(   s   root=Ns<   install everything relative to this alternate root directory(   s   install-purelib=Ns;   installation directory for pure Python module distributions(   s   install-platlib=Ns8   installation directory for non-pure module distributions(   s   install-headers=Ns(   installation directory for C/C++ headers(   s   install-scripts=Ns)   installation directory for Python scripts(   s   install-data=Ns%   installation directory for data files(   s   compileR   s   compile .py to .pyc [default](   s
   no-compileNs   don't compile .py files(   s	   optimize=R    sl   also compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0](   s   forceR"   s1   force installation (overwrite any existing files)(   s
   skip-buildNs2   skip rebuilding everything (for testing/debugging)(   s   record=Ns3   filename in which to record list of installed files(   t   __name__t
   __module__t   descriptionR#   R   Rm   t   boolean_optionsRn   R;   Rh   RP   RQ   RR   Ru   R   R\   R]   R`   Ra   Rf   R^   R¢   R   R   RØ   R¬   R­   R®   R°   t   sub_commands(    (    (    s/   scripts/common/Lib/distutils/command/install.pyR   l   s      
           		M			+				
					"			.											(   s   purelibs   platlibs   headerss   scriptss   data(    t   __doc__t	   distutilsR    t   __revision__RU   RM   RS   t   typest   distutils.coreR   t   distutils.debugR   t   distutils.sysconfigR   t   distutils.errorsR   t   distutils.file_utilR   t   distutils.utilR   R   R	   R
   R   t   siteR   R   RV   t   WINDOWS_SCHEMERz   R{   R   (    (    (    s/   scripts/common/Lib/distutils/command/install.pyt   <module>   s   $

