Ñò
¿ÖJc           @   s  d  d k  Z d  d k Z d  d k Z d  d k l Z d  d k l Z d  d k	 l	 Z	 yr d  d k l
 Z d  d k l Z d  d k l Z l Z d  d k Z d e f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ
 Wn& e j
 o d
 d d „  ƒ  YZ
 n Xd e e
 f d „  ƒ  YZ d „  Z d S(   iÿÿÿÿN(   t   build_py(   t   convert_path(   t   glob(   t	   Mixin2to3(   t   log(   t   RefactoringToolt   get_fixers_from_packaget   DistutilsRefactoringToolc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         O   s   t  i | | Œ d  S(   N(   R   t   error(   t   selft   msgt   argst   kw(    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyt	   log_error   s    c         G   s   t  i | | Œ d  S(   N(   R   t   info(   R	   R
   R   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyt   log_message   s    c         G   s   t  i | | Œ d  S(   N(   R   t   debug(   R	   R
   R   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyt	   log_debug   s    (   t   __name__t
   __module__R   R   R   (    (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR      s   		R   c           B   s   e  Z e d  „ Z RS(   c      
   C   s  |  i  i t j	 o d  S| p d  St i d d i | ƒ ƒ |  i p{ g  |  _ x' t i D] } |  i i	 t
 | ƒ ƒ q[ W|  i  i d  j	 o1 x. |  i  i D] } |  i i	 t
 | ƒ ƒ q› WqÃ n | o: t i o, t |  i ƒ } | i | d t d t ƒqn t i |  | ƒ d  S(   Ns   Fixing t    t   writet   doctests_only(   t   distributiont   use_2to3t   TrueR   R   t   joint   fixer_namest
   setuptoolst   lib2to3_fixer_packagest   extendR   t   use_2to3_fixerst   Nonet   run_2to3_on_doctestsR   t   refactort
   _Mixin2to3t   run_2to3(   R	   t   filest   doctestst   pt   r(    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR$      s&    
	
  "
!(   R   R   t   FalseR$   (    (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR      s   c           B   s   e  Z e d  „ Z RS(   c         C   s   d  S(   N(    (   R	   R%   R&   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR$   /   s    (   R   R   R   R$   (    (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR   .   s   R    c           B   s£   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z e i d
 j  o d d „ Z n d „  Z d „  Z d „  Z d „  Z RS(   sX  Enhanced 'build_py' command that includes data files with packages

    The data files are specified via a 'package_data' argument to 'setup()'.
    See 'setuptools.dist.Distribution' for more details.

    Also, this version of the 'build_py' command allows you to specify both
    'py_modules' and 'packages' in the same setup operation.
    c         C   sf   t  i |  ƒ |  i i |  _ |  i i p h  |  _ d |  i j o |  i d =n g  |  _ g  |  _ d  S(   Nt
   data_files(   t	   _build_pyt   finalize_optionsR   t   package_datat   exclude_package_datat   __dict__t   _build_py__updated_filest   _build_py__doctests_2to3(   R	   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR,   <   s     	c         C   s®   |  i  o |  i o d S|  i  o |  i ƒ  n |  i o |  i ƒ  |  i ƒ  n |  i |  i t ƒ |  i |  i t ƒ |  i |  i	 t ƒ |  i
 t i |  d d ƒƒ d S(   s?   Build modules, packages, and copy data files to build directoryNt   include_bytecodei    (   t
   py_modulest   packagest   build_modulest   build_packagest   build_package_dataR$   R0   R)   R   R1   t   byte_compileR+   t   get_outputs(   R	   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyt   runD   s    


c         C   s5   | d j o |  i  ƒ  |  _ } | St i |  | ƒ S(   NR*   (   t   _get_data_filesR*   R+   t   __getattr__(   R	   t   attrR%   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR<   X   s     c         C   sC   t  i |  | | | ƒ \ } } | o |  i i | ƒ n | | f S(   N(   R+   t   build_moduleR0   t   append(   R	   t   modulet   module_filet   packaget   outfilet   copied(    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR>   ]   s    c   	      C   s½   |  i  ƒ  g  } x¦ |  i p d D]” } |  i | ƒ } t i i |  i g | i d ƒ Œ  } t | ƒ d } g  } |  i	 | | ƒ D] } | | | q‚ ~ } | i
 | | | | f ƒ q! W| S(   s?   Generate list of '(package,src_dir,build_dir,filenames)' tuplest   .i   (    (   t   analyze_manifestR4   t   get_package_dirt   ost   pathR   t	   build_libt   splitt   lent   find_data_filesR?   (	   R	   t   dataRB   t   src_dirt	   build_dirt   plent   _[1]t   filet	   filenames(    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR;   c   s    
 %1c         C   sŠ   |  i  i d g  ƒ |  i  i | g  ƒ } |  i i | g  ƒ } x6 | D]. } | i t t i i | t | ƒ ƒ ƒ ƒ qE W|  i	 | | | ƒ S(   s6   Return filenames for package's data files in 'src_dir't    (
   R-   t   gett   manifest_filesR   R   RH   RI   R   R   t   exclude_data_files(   R	   RB   RO   t   globsR%   t   pattern(    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyRM   x   s     ,c         C   sÖ   d } xÉ |  i D]¾ \ } } } } x© | D]¡ } t i i | | ƒ } |  i t i i | ƒ ƒ t i i | | ƒ } |  i | | ƒ \ }	 }
 t i i | ƒ } |
 o' | |  i	 i
 j o |  i i |	 ƒ q) q) Wq Wd S(   s$   Copy data files into build directoryN(   R    R*   RH   RI   R   t   mkpatht   dirnamet	   copy_filet   abspathR   t   convert_2to3_doctestsR1   R?   (   R	   t   lastdirRB   RO   RP   RT   t   filenamet   targett   srcfilet   outfRD   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR7   ‚   s    
  c         C   sh  h  |  _  } |  i i p d  Sh  } x1 |  i p d D] } | | t |  i | ƒ ƒ <q6 W|  i d ƒ |  i d ƒ } xì | i i	 D]Þ } t
 i i t | ƒ ƒ \ } } d  } | }	 xY | oQ | | j oD | | j o7 | } t
 i i | ƒ \ } }
 t
 i i |
 | ƒ } qµ W| | j oE | i d ƒ o | |	 j o q‚ n | i | | g  ƒ i | ƒ q‚ q‚ Wd  S(   Nt   egg_infos   .py(    (   RW   R   t   include_package_dataR4   t   assert_relativeRG   t   run_commandt   get_finalized_commandt   filelistR%   RH   RI   RK   R    R   t   endswitht
   setdefaultR?   (   R	   t   mft   src_dirsRB   t   ei_cmdRI   t   dt   ft   prevt   oldft   df(    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyRF      s.       !c         C   s   d  S(   N(    (   R	   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyt   get_data_files¨   s    s   2.4i   c         C   sZ   t  i |  | ƒ g  } |  i D]5 \ } } } } | D] } | t i i | | ƒ q3 q ~ S(   sj  Return complete list of files copied to the build directory

            This includes both '.py' files and data files, as well as '.pyc'
            and '.pyo' files if 'include_bytecode' is true.  (This method is
            needed for the 'install_lib' command to do its job properly, and to
            generate a correct installation manifest.)
            (   R+   R9   R*   RH   RI   R   (   R	   R2   RR   RB   RO   RP   RT   Ra   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR9   «   s    c      	   C   s÷   y |  i  | SWn t j
 o n Xt i |  | | ƒ } | |  i  | <| p |  i i o | Sx> |  i i D], } | | j p | i | d ƒ o Pqo qo W| St | d ƒ } d | i ƒ  j o$ d d k	 l
 } | i d | ƒ n | i ƒ  | S(   s8   Check namespace packages' __init__ for declare_namespaceRE   t   rUt   declare_namespaceiÿÿÿÿ(   R   s¼   WARNING: %s is a namespace package, but its __init__.py does
not declare_namespace(); setuptools 0.7 will REQUIRE this!
(See the setuptools manual under "Namespace Packages" for details.)
(   t   packages_checkedt   KeyErrorR+   t   check_packageR   t   namespace_packagest
   startswitht   opent   readt	   distutilsR   t   warnt   close(   R	   RB   t   package_dirt   init_pyt   pkgRq   R   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyRz   ¹   s*     !	
c         C   s   h  |  _  t i |  ƒ d  S(   N(   Rx   R+   t   initialize_options(   R	   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR…   Ø   s    	c         C   sC   t  i |  | ƒ } |  i i d  j	 o t i i |  i i | ƒ S| S(   N(   R+   RG   R   t   src_rootR    RH   RI   R   (   R	   RB   t   res(    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyRG   Ý   s    c   
      C   sÒ   |  i  i d g  ƒ |  i  i | g  ƒ } g  } x< | D]4 } | i t i | t i i | t | ƒ ƒ ƒ ƒ q5 Wt	 i
 | ƒ } h  } g  } | D]> }	 |	 | j o+ |	 | j o | i |	 d ƒ o | |	 q q ~ S(   s6   Filter filenames for package's data files in 'src_dir'RU   i   (   R.   RV   R   t   fnmatcht   filterRH   RI   R   R   t   dictt   fromkeysRl   (
   R	   RB   RO   R%   RY   t   badRZ   t   seenRR   Rq   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyRX   ä   s     &(   R   R   t   __doc__R,   R:   R<   R>   R;   RM   R7   RF   Ru   t   syst   versionR9   Rz   R…   RG   RX   (    (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyR    3   s    						
						c         C   s<   t  i i |  ƒ p |  Sd d k l } | d |  ƒ ‚ d  S(   Niÿÿÿÿ(   t   DistutilsSetupErrorsª   Error: setup script specifies an absolute path:

    %s

setup() arguments must *always* be /-separated paths relative to the
setup.py directory, *never* absolute paths.
(   RH   RI   t   isabst   distutils.errorsR‘   (   RI   R‘   (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyRg   ÷   s
    (    (   t   os.pathRH   R   Rˆ   t   distutils.command.build_pyR    R+   t   distutils.utilR   R   R   R#   R   R   t   lib2to3.refactorR   R   R   R   t   ImportErrorRg   (    (    (    s?   /usr/lib/python2.6/dist-packages/setuptools/command/build_py.pyt   <module>   s   $
Ä