
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
ó
wWS`c           @   s/  d  Z  d Z d d l Z d d l Z d d l Z d d l Z d d l Td d l m Z m	 Z	 d d l
 m Z d d l Td d l m Z 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 k rý d d l m Z e e ƒ  ƒ Z n  e j d ƒ Z d „  Z d e f d „  ƒ  YZ  d S(   s¶   distutils.command.build_ext

Implements the Distutils 'build_ext' command, for building extension
modules (currently limited to C extensions, should accommodate C++
extensions ASAP).s   $Id$iÿÿÿÿN(   t   *(   t	   USER_BASEt	   USER_SITE(   t   Command(   t   customize_compilert   get_python_version(   t   newer_group(   t	   Extension(   t   get_platform(   t   logt   nt(   t   get_build_versions3   ^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$c          C   s   d d l  m }  |  ƒ  d  S(   Niÿÿÿÿ(   t   show_compilers(   t   distutils.ccompilerR   (   R   (    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyR       s    t	   build_extc           B   s?  e  Z d  Z d e j Z dF dG d d	 d
 e ƒ  f d d d d f d d d e f dH dI dJ d d d e f dK dL dM dN dO dQ dR dS dT g Z d d$ d' d- d3 g Z	 d5 dP d6 e
 f g Z d7 „  Z d8 „  Z d9 „  Z d: „  Z d; „  Z d< „  Z d= „  Z d> „  Z d? „  Z d@ „  Z dA „  Z dB „  Z dC „  Z dD „  Z dE „  Z RS(U   s8   build C/C++ extensions (compile/link to build directory)s    (separated by '%s')s
   build-lib=t   bs(   directory for compiled extension moduless   build-temp=t   ts1   directory for temporary files (build by-products)s
   plat-name=t   ps>   platform name to cross-compile for, if supported (default: %s)t   inplacet   is=   ignore build-lib and put compiled extensions into the source s,   directory alongside your pure Python moduless   include-dirs=t   Is.   list of directories to search for header filess   define=t   Ds   C preprocessor macros to defines   undef=t   Us!   C preprocessor macros to undefines
   libraries=t   ls!   external C libraries to link withs   library-dirs=t   Ls.   directories to search for external C librariess   rpath=t   Rs7   directories to search for shared C libraries at runtimes   link-objects=t   Os2   extra explicit link objects to include in the linkt   debugt   gs'   compile/link with debugging informationt   forcet   fs2   forcibly build everything (ignore file timestamps)s	   compiler=t   cs   specify the compiler types   swig-cpps)   make SWIG create C++ files (default is C)s
   swig-opts=s!   list of SWIG command line optionss   swig=s   path to the SWIG executablet   users#   add user include, library and rpaths   help-compilers   list available compilersc         C   s¸   d  |  _ d  |  _ d  |  _ d  |  _ d |  _ d  |  _ d  |  _ d  |  _ d  |  _	 d  |  _
 d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  S(   Ni    (   t   Nonet
   extensionst	   build_libt	   plat_namet
   build_tempR   t   packaget   include_dirst   definet   undeft	   librariest   library_dirst   rpatht   link_objectsR   R   t   compilert   swigt   swig_cppt	   swig_optsR    (   t   self(    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyt   initialize_optionsl   s(    																			c   
   	   C   s©  d d l  m } |  j d d. d/ d0 d1 d2 d3 ƒ |  j d  k rP |  j j |  _ n  |  j j |  _ | j	 ƒ  } | j	 d
 d ƒ } |  j
 d  k r¤ |  j j
 p› g  |  _
 n  t |  j
 t ƒ rÑ |  j
 j t j ƒ |  _
 n  |  j
 j | ƒ | | k r |  j
 j | ƒ n  |  j d ƒ |  j d ƒ |  j d  k r5g  |  _ n  |  j d  k rPg  |  _ n3 t |  j ƒ t k rƒt j |  j t j ƒ |  _ n  |  j d  k ržg  |  _ n3 t |  j ƒ t k rÑt j |  j t j ƒ |  _ n  t j d k r‡|  j j t j j t j d ƒ ƒ |  j r)t j j |  j d ƒ |  _ n t j j |  j d ƒ |  _ |  j
 j t j j t j d ƒ ƒ t d k r÷|  j  d k rŠd } n |  j  d } xê d4 d5 f D]L } t j j t j | Œ } | ràt j j | | ƒ } n  |  j j | ƒ q¤Wq‡t d k r+|  j j t j j t j d d ƒ ƒ q‡t d k r_|  j j t j j t j d d ƒ ƒ q‡|  j j t j j t j d d ƒ ƒ n  t j d k r»|  j j t j j t j d ƒ ƒ n  t j! d   d! k sát j! d   d" k rJt j" j# t j j t j d# ƒ ƒ r7|  j j t j j t j$ d$ d% t% ƒ  d& ƒ ƒ qJ|  j j d' ƒ n  | j& d( ƒ r‘| j' s~|  j j | j& d) ƒ ƒ q‘|  j j d' ƒ n  |  j( rÄ|  j( j d* ƒ } t) d+ „  | ƒ |  _( n  |  j* rå|  j* j d* ƒ |  _* n  |  j+ d  k r g  |  _+ n |  j+ j d, ƒ |  _+ |  j, r¥t j j t- d- ƒ } t j j t- d$ ƒ }	 t j j. | ƒ rm|  j
 j | ƒ n  t j j. |	 ƒ r¥|  j j |	 ƒ |  j j |	 ƒ q¥n  d  S(6   Niÿÿÿÿ(   t	   sysconfigt   buildR#   R%   R.   R   R   R$   t   plat_specifici   R*   R-   R
   t   libst   Debugt   Releaset   PCi	   t   win32t    i   t   PCbuilds   VS9.0i   s   VS8.0i   s   VS7.1t   VC6t   os2t   Configi   t   cygwint   atheost   bint   libt   pythont   configt   .t   Py_ENABLE_SHAREDt   LIBDIRt   ,c         S   s
   |  d f S(   Nt   1(    (   t   symbol(    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyt   <lambda>ÿ   R<   t    t   include(   R#   R#   (   R%   R%   (   R.   R.   (   R   R   (   R   R   (   R$   R$   (   R=   (   R:   s   VS9.0(/   t	   distutilsR4   t   set_undefined_optionsR&   R!   t   distributiont   ext_packaget   ext_modulesR"   t   get_python_incR'   t
   isinstancet   strt   splitt   ost   pathsept   appendt   ensure_string_listR*   R+   t   typet
   StringTypet   stringR,   t   namet   patht   joint   syst   exec_prefixR   R%   t   MSVC_VERSIONR$   t   platformt
   executablet
   startswitht   prefixR   t   get_config_vart   python_buildR(   t   mapR)   R1   R    R   t   isdir(
   R2   R4   t
   py_includet   plat_py_includet   suffixt   dt   new_libt   definest   user_includet   user_lib(    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyt   finalize_optionsƒ   s¦    	"	"	%&$
				c      	   C   s  d d l  m } |  j s d  S|  j j ƒ  rm |  j d ƒ } |  j j | j ƒ  pS g  ƒ |  j	 j
 | j ƒ n  | d |  j d |  j d |  j d |  j ƒ |  _ t |  j ƒ t j d k rá |  j t ƒ  k rá |  j j |  j ƒ n  |  j d  k	 r|  j j |  j ƒ n  |  j d  k	 rEx- |  j D] \ } } |  j j | | ƒ qWn  |  j d  k	 r{x$ |  j D] } |  j j | ƒ q^Wn  |  j d  k	 r |  j j |  j ƒ n  |  j	 d  k	 rÅ|  j j |  j	 ƒ n  |  j d  k	 rê|  j j  |  j ƒ n  |  j! d  k	 r|  j j" |  j! ƒ n  |  j# ƒ  d  S(	   Niÿÿÿÿ(   t   new_compilert
   build_clibR.   t   verboset   dry_runR   R
   ($   R   Rw   R"   RR   t   has_c_librariest   get_finalized_commandR*   t   extendt   get_library_namesR+   R[   Rx   R.   Ry   Rz   R   R   RY   R`   R$   R   t
   initializeR'   R!   t   set_include_dirsR(   t   define_macroR)   t   undefine_macrot   set_librariest   set_library_dirsR,   t   set_runtime_library_dirsR-   t   set_link_objectst   build_extensions(   R2   Rw   Rx   R`   t   valuet   macro(    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyt   run  s>    			!c   
      C   s!  t  | t ƒ s t d ‚ n  xÿt | ƒ D]ñ\ } } t  | t ƒ rI q( n  t  | t ƒ sk t | ƒ d k rw t d ‚ n  | \ } } t j d | ƒ t  | t	 ƒ o¯ t
 j | ƒ s¾ t d ‚ n  t  | t ƒ sÙ t d ‚ n  t | | d ƒ } x< d D]4 } | j | ƒ } | d k	 ró t | | | ƒ qó qó W| j d ƒ | _ d | k rYt j d ƒ n  | j d ƒ } | rg  | _ g  | _ xŒ | D]� }	 t  |	 t ƒ o«t |	 ƒ d k sºt d ‚ n  t |	 ƒ d k rã| j j |	 d ƒ q‡t |	 ƒ d k r‡| j j |	 ƒ q‡q‡Wn  | | | <q( Wd S(   s¬  Ensure that the list of extensions (presumably provided as a
        command option 'extensions') is valid, i.e. it is a list of
        Extension objects.  We also support the old-style list of 2-tuples,
        where the tuples are (ext_name, build_info), which are converted to
        Extension instances here.

        Raise DistutilsSetupError if the structure is invalid anywhere;
        just returns otherwise.
        s:   'ext_modules' option must be a list of Extension instancesi   sM   each element of 'ext_modules' option must be an Extension instance or 2-tuplesv   old-style (ext_name, build_info) tuple found in ext_modules for extension '%s' -- please convert to Extension instancesR   first element of each tuple in 'ext_modules' must be the extension name (a string)sO   second element of each tuple in 'ext_modules' must be a dictionary (build info)t   sourcesR'   R+   R*   t   extra_objectst   extra_compile_argst   extra_link_argsR,   t   def_files9   'def_file' element of build info dict no longer supportedt   macrosi   s9   'macros' element of build info dict must be 1- or 2-tuplei    N(   R'   R+   R*   RŒ   R�   RŽ   (   i   i   (   RV   t   listt   DistutilsSetupErrort	   enumerateR   t   tuplet   lenR	   t   warnRW   t   extension_name_ret   matcht   dictt   getR!   t   setattrt   runtime_library_dirst   define_macrost   undef_macrosR[   (
   R2   R"   R   t   extt   ext_namet
   build_infot   keyt   valR�   R‰   (    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyt   check_extensions_listV  sT    
	"				 
		!	c         C   s>   |  j  |  j ƒ g  } x! |  j D] } | j | j ƒ q  W| S(   N(   R¤   R"   R}   R‹   (   R2   t	   filenamesRŸ   (    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyt   get_source_files¤  s
    c         C   sG   |  j  |  j ƒ g  } x* |  j D] } | j |  j | j ƒ ƒ q  W| S(   N(   R¤   R"   R[   t   get_ext_fullpathR`   (   R2   t   outputsRŸ   (    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyt   get_outputs®  s
    c         C   s5   |  j  |  j ƒ x |  j D] } |  j | ƒ q Wd  S(   N(   R¤   R"   t   build_extension(   R2   RŸ   (    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyR‡   ¼  s    c   
      C   sþ  | j  } | d  k s- t | ƒ t t f k rH t d d d | j ‚ n  t | ƒ } |  j | j ƒ } | | j	 } |  j
 p‹ t | | d ƒ s¥ t j d | j ƒ d  St j d | j ƒ |  j | | ƒ } | j pÖ g  } | j } x! | j D] } | j | f ƒ qí W|  j j | d |  j d | d	 | j d
 |  j d | d | j	 ƒ} | |  _ | j ro| j | j ƒ n  | j p{g  } | j p–|  j j | ƒ }	 |  j j | | d |  j | ƒ d | j  d | j! d | d |  j" | ƒ d
 |  j d |  j d |	 ƒd  S(   Ns*   in 'ext_modules' option (extension '%s'), s&   'sources' must be present and must be s   a list of source filenamest   newers$   skipping '%s' extension (up-to-date)s   building '%s' extensiont
   output_dirR�   R'   R   t   extra_postargst   dependsR*   R+   Rœ   t   export_symbolsR%   t   target_lang(#   R‹   R!   R]   t   ListTypet	   TupleTypeR’   R`   R‘   R§   R®   R   R   R	   R   t   infot   swig_sourcesR�   R�   Rž   R[   R.   t   compileR%   R'   t   _built_objectsRŒ   R}   RŽ   t   languaget   detect_languaget   link_shared_objectt   get_librariesR+   Rœ   t   get_export_symbols(
   R2   RŸ   R‹   t   ext_pathR®   t
   extra_argsR�   R)   t   objectsR·   (    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyRª   Ã  sN    	$
			
							c         C   s£  g  } g  } i  } |  j  r+ t j d ƒ n  |  j  sR d |  j k sR d | j k r[ d } n d } xr | D]j } t j j | ƒ \ } }	 |	 d k rÅ | j | d | ƒ | j | ƒ | d | | <qh | j | ƒ qh W| sà | S|  j pò |  j	 ƒ  }
 |
 d g } | j
 |  j ƒ |  j  r*| j d ƒ n  |  j sWx! | j D] } | j | ƒ q=Wn  xE | D]= } | | } t j d	 | | ƒ |  j | d
 | | g ƒ q^W| S(   sü   Walk the list of source files in 'sources', looking for SWIG
        interface (.i) files.  Run SWIG on all that are found, and
        return a modified 'sources' list with SWIG source files replaced
        by the generated C (or C++) files.
        s/   --swig-cpp is deprecated - use --swig-opts=-c++s   -c++s   .cpps   .cs   .it   _wrapiÿÿÿÿs   -pythons   swigging %s to %ss   -o(   R0   R	   R–   R1   RY   Ra   t   splitextR[   R/   t	   find_swigR}   R³   t   spawn(   R2   R‹   t	   extensiont   new_sourcesR´   t   swig_targetst
   target_extt   sourcet   baseRŸ   R/   t   swig_cmdt   ot   target(    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyR´     s>    				
c         C   s�   t  j d k r d St  j d k ri xg d D]5 } t  j j d | d ƒ } t  j j | ƒ r) | Sq) Wd Sn# t  j d	 k r| d St d
 t  j ‚ d S(   s›   Return the name of the SWIG executable.  On Unix, this is
        just "swig" -- it should be in the PATH.  Tries a bit harder on
        Windows.
        t   posixR/   R
   s   1.3s   1.2s   1.1s	   c:\swig%ss   swig.exeR?   s>   I don't know how to find (much less run) SWIG on platform '%s'N(   s   1.3s   1.2s   1.1(   RY   R`   Ra   Rb   t   isfilet   DistutilsPlatformError(   R2   t   verst   fn(    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyRÁ   P  s    c   	      C   sú   t  j d t j d ƒ } | j | ƒ } |  j | ƒ } | j d ƒ } |  j | ƒ } t j j | ƒ d } |  j	 s§ t j j
 | d  | g Œ  } t j j
 |  j | ƒ Sd j
 | d d !ƒ } |  j d ƒ } t j j | j | ƒ ƒ } t j j
 | | ƒ S(   s¡   Returns the path of the filename for a given extension.

        The file is located in `build_lib` or directly in the package
        (inplace option).
        t   /s   ..RG   iÿÿÿÿi    t   build_py(   R_   t	   maketransRY   t   sept	   translatet   get_ext_fullnameRX   t   get_ext_filenameRa   R   Rb   R#   R|   t   abspatht   get_package_dir(	   R2   R    t   all_dotst   fullnamet   modpatht   filenameR&   RÒ   t   package_dir(    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyR§   q  s    	c         C   s&   |  j  d k r | S|  j  d | Sd S(   sS   Returns the fullname of a given extension name.

        Adds the `package.` prefixRG   N(   R&   R!   (   R2   R    (    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyRÖ   ‘  s    c         C   s½   d d l  m } t j | d ƒ } t j d k rZ | t | ƒ d d  | t | ƒ d <n  | d ƒ } t j d k r– |  j r– t j j	 | Œ  d	 | St j j	 | Œ  t
 j r´ d	 p· d
 | S(   s¦   Convert the name of an extension (eg. "foo.bar") into the name
        of the file from which it will be loaded (eg. "foo/bar.so", or
        "foo\bar.pyd").
        iÿÿÿÿ(   Rj   RG   R?   i   i   t   SOR
   t   _dR<   (   t   distutils.sysconfigRj   R_   RX   RY   R`   R•   R   Ra   Rb   Rc   t   pydebug(   R2   R    Rj   R¼   t   so_ext(    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyR×   š  s    )c         C   sC   d | j  j d ƒ d } | | j k r< | j j | ƒ n  | j S(   s  Return the list of symbols that a shared extension has to
        export.  This either uses 'ext.export_symbols' or, if it's not
        provided, "init" + module_name.  Only relevant on Windows, where
        the .pyd file (DLL) must export the module "init" function.
        t   initRG   iÿÿÿÿ(   R`   RX   R¯   R[   (   R2   RŸ   t   initfunc_name(    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyR»   ¬  s    c         C   sq  t  j d k r‡ d d l m } t |  j | ƒ s} d } |  j rM | d } n  | t  j d ?t  j d ?d @f } | j | g S| j Snæt  j d	 k rÌ d } | t  j d ?t  j d ?d @f } | j | g St  j d
  d k rd } | t  j d ?t  j d ?d @f } | j | g St  j d
  d k rËd d l	 m
 } d } | t  j d ?t  j d ?d @f } g  } xM | j d ƒ j ƒ  D]6 } | j d ƒ r¥| j | d ƒ q|| j | ƒ q|W| j | d g | St  j d k rá| j St  j d  d k rû| j Sd d l	 m
 } | j d ƒ rfd } | t  j d ?t  j d ?d @f } t  j rX| d 7} n  | j | g S| j Sd S(   sÜ   Return the list of libraries to link against when building a
        shared extension.  On most platforms, this is just 'ext.libraries';
        on Windows and OS/2, we add the Python library (eg. python20.dll).
        R;   iÿÿÿÿ(   t   MSVCCompilers
   python%d%dRà   i   i   iÿ   t   os2emxi   RA   s   python%d.%dRB   (   R4   t   SHLIBSs   -li   t   mt   darwini   t   aixRH   N(   Rc   Rf   t   distutils.msvccompilerRæ   RV   R.   R   t
   hexversionR*   RP   R4   Rj   RX   Rh   R[   Râ   (   R2   RŸ   Ræ   t   templatet	   pythonlibR4   t   extraRD   (    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyRº   ·  sX    
	
	(   s
   build-lib=R   s(   directory for compiled extension modules(   s   build-temp=R   s1   directory for temporary files (build by-products)(   s   define=R   s   C preprocessor macros to define(   s   undef=R   s!   C preprocessor macros to undefine(   s
   libraries=R   s!   external C libraries to link with(   s   rpath=R   s7   directories to search for shared C libraries at runtime(   s   link-objects=R   s2   extra explicit link objects to include in the link(   R   R   s'   compile/link with debugging information(   R   R   s2   forcibly build everything (ignore file timestamps)(   s	   compiler=R   s   specify the compiler typeN(   s   swig-cppNs)   make SWIG create C++ files (default is C)(   s
   swig-opts=Ns!   list of SWIG command line options(   s   swig=Ns   path to the SWIG executable(   R    Ns#   add user include, library and rpath(   t   __name__t
   __module__t   descriptionRY   RZ   t   sep_byR   R!   t   user_optionst   boolean_optionsR   t   help_optionsR3   Rv   RŠ   R¤   R¦   R©   R‡   Rª   R´   RÁ   R§   RÖ   R×   R»   Rº   (    (    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyR   %   st     

   
         			“	@	N	
			S	:	!	 				(!   t   __doc__t   __revision__Rc   RY   R_   t   ret   typest   siteR   R   t   distutils.coreR   t   distutils.errorsRá   R   R   t   distutils.dep_utilR   t   distutils.extensionR   t   distutils.utilR   RP   R	   R`   Rì   R   t   intRe   Rµ   R—   R   R   (    (    (    s@   /opt/alt/python27/lib64/python2.7/distutils/command/build_ext.pyt   <module>   s$   0

		