
'>Qc           @   sz  d  Z  d d l Z d d l Z d d l Z d d l m Z m Z d d l m Z e d   i d g d 6d d	 d
 d g d 6e j	 d  p d g d 6d	 g d 6d g d 6 Z
 d d l Z d d l m Z d d l m Z d d l Z e j d d k  r8d d l Z d d l m Z e j d k rvd d l m Z qvn> d d l Z d d l m Z e j d k rvd d l m Z n  e a e a e a e a e a e a  e a! e a" e a# e a$ e a% e a$ e a& e a' e a( d Z) d a+ g  Z, i e- d 6e d 6d d 6d d 6d d 6e- d 6d d  6d d! 6d d" 6d d# 6e- d$ 6e- d% 6d d& 6d d' 6Z. d d g Z/ e j d d k rye/ j0 d  n  e j1 j2 d- d.  Z3 e j4 j5 e3  re j6   Z7 e7 j8 e3  y e7 j9 d/ d0  e. d <Wn n Xy e7 j9 d/ d  e. d <Wn n Xy e7 j9 d1 d2  e. d <Wn d e. d <n Xy e7 j9 d1 d3  e. d <Wn d e. d <n Xy e7 j9 d1 d4  e. d <Wn d e. d <n Xy e7 j9 d5 d6  e. d  <Wn d e. d  <n Xy e7 j9 d5 d7  e. d! <Wn d e. d! <n Xy e7 j9 d5 d8  e. d" <Wn d e. d" <n Xy e7 j9 d5 d9  e. d# <Wn d e. d# <n Xy e7 j2 d: d&  e. d& <Wn n Xy e7 j2 d; d'  e. d' <WqqXn  e. d' re. d' j:   Z; n e
 e j Z; d< e; GHd=   Z< e. d r d> d?  Z= d@   Z> dA   Z? dB   Z@ n dC   Z= e= Z> Z? Z@ e jA ZA dD   ZB eB e _A dE   ZC dF d dG     YZD dH   ZE dI   ZF eF   ZG e j d k reG dJ k rg  ZH n dK dL g ZH dM   ZI dN   ZJ d eJ _K dO dP e dQ  ZL dR   ZM dS   ZN dT   ZO dU   ZP dV   ZQ dW   ZR dX   ZS dY   ZT dZ   ZU d[   ZV d\   ZW d]   ZX d^   ZY d_   ZZ d`   Z[ da   Z\ db   Z] dc   Z^ dd   Z_ de   Z` df   Za dg   Zb dh   Zc di   Zd dj   Ze dk   Zf dl   Zg dm   Zh dn   Zi do   Zj dp   Zk dq   Zl dr   Zm ds   Zn dt   Zo du   Zp dv   Zq dw   Zr dx   Zs dy   Zt dz   Zu d{   Zv d|   Zw d}   Zx d~   Zy d   Zz d   Z{ d   Z| d S(   s  
Some helper functions for building the C extensions

You may need to use the "basedirlist" option in setup.cfg to point
to the location of your required libs, eg, png, z, freetype,
overriding the settings hard-coded in the "basedir" directory
below.

DARWIN

  I have installed all of the backends on OSX.

  Tk: If you want to install TkAgg, I recommend the "batteries included"
  binary build of Tcl/Tk at
  http://www.apple.com/downloads/macosx/unix_open_source/tcltkaqua.html

  GTK: I installed GTK from src as described at
  http://www.macgimp.org/index.php?topic=gtk.  There are several
  packages, but all configure/make/make install w/o problem.  In
  addition to the packages listed there, You will also need libpng,
  libjpeg, and libtiff if you want output to these formats from GTK.

WIN32 - MINGW

  If you are sufficiently masochistic that you want to build this
  yourself, download the win32_static dir from
  http://matplotlib.sourceforge.net/win32_static.tar.gz and
  see the README file in that dir

  > python setup.py build --compiler=mingw32 bdist_wininst  > build23.out

  NOTE, if you are building on python24 on win32, see
  http://mail.python.org/pipermail/python-list/2004-December/254826.html

WIN32 - VISUAL STUDIO 7.1 (2003)

  This build is similar to the mingw.  Download the visual studio static
  dependencies from
  http://matplotlib.sourceforge.net/win32_static_vs.tar.gz and
  see the README in that dir

  > python setup.py build --compiler=msvc bdist_wininst

iN(   t	   sysconfigt   version(   t   defaultdictc           C   s
   d d g S(   Ns
   /usr/locals   /usr(    (    (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   <lambda>9   s    t   win32_statict   win32s   /usr/local/s   /usrs   /usr/X11s
   /opt/localt   darwint
   MPLIB_BASEs
   /usr/localt   sunos5t   gnu0t   aix5(   t   fill(   t	   Extensioni    i   (   t   StringIO(   t   getstatusoutputt   agg24t   display_statust   verboset   autot   provide_pytzt   provide_dateutilt   provide_sixt	   build_aggt	   build_gtkt   build_gtkaggt   build_tkaggt   build_macosxt   build_imaget   build_windowingt   backendt   basedirlistt   PY_ARRAY_UNIQUE_SYMBOLt   MPL_ARRAY_APIt   PYCXX_ISO_CPP_LIBt   1t   PYCXX_PYTHON_2TO3t   MPLSETUPCFGs	   setup.cfgt   statust   suppresst   provide_packagest   pytzt   dateutilt   sixt   gui_supportt   gtkt   gtkaggt   tkaggt   macosxt
   rc_optionst   directoriess   basedirlist is: %sc          O   sC   t  |  |   } x- t D]% } | j j t j j | d   q W| S(   Nt   include(   R   R   t   include_dirst   appendt   ost   patht   join(   t   argst   kwargst   extt   dir(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   make_extension   s    #t   =c         C   s   |  d GHd  S(   NiL   (    (   t   char(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt
   print_line   s    c         C   s;   d |  } d d } t  t |  d d d | d | GHd  S(   Ns   %22s: t    i   t   widthiL   t   initial_indentt   subsequent_indent(   R   t   str(   t   packageR%   RB   t   indent(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   print_status   s
    

c         C   s5   d d d } t  t |   d d d | d | GHd  S(   NR@   i   s   * RA   iL   RB   RC   (   R   RD   (   t   messageRF   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   print_message   s    c         C   s	   |  GHd  S(   N(    (   t   section(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt	   print_raw   s    c          O   s   d  S(   N(    (   R8   R9   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR?      s    c         C   s>   t  |   } y |  j j d  Wn t t f k
 r9 n X| S(   Ns   -Wstrict-prototypes(   t   customize_compilert   compiler_sot   removet
   ValueErrort   AttributeError(   t   compilert   retval(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   my_customize_compiler   s    c         C   sO   t  j |  d t d t  j d t  j d t  j d t j d k } | j | j f S(   Nt   shellt   stdint   stdoutt   stderrt	   close_fdsR   (	   t
   subprocesst   Popent   Truet   PIPEt   STDOUTt   syst   platformRU   RV   (   t   cmdt   p(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   run_child_process   s    			t   CleanUpFilec           B   s    e  Z d  Z d   Z d   Z RS(   sB   CleanUpFile deletes the specified filename when self is destroyed.c         C   s   | |  _  d  S(   N(   t   name(   t   selfRd   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   __init__   s    c         C   s   t  j |  j  d  S(   N(   R5   RN   Rd   (   Re   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   __del__   s    (   t   __name__t
   __module__t   __doc__Rf   Rg   (    (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyRc      s   	c         C   sn   t  |   j   } t  | d  j |  t j |   } t j | | j | j f  t |  t	   d | <d S(   s   temp_copy copies a named file into a named temporary file.
    The temporary will be deleted when the setupext module is destructed.
    s   w+t	   _cleanup_N(
   t   opent   readt   writeR5   t   statt   utimet   st_atimet   st_mtimeRc   t   globals(   t   _fromt   _tot   st   stats(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt	   temp_copy   s
    c          C   s(   x! t  j D] }  d |  k r
 d Sq
 Wd S(   Nt   mingw32t   msvc(   R^   t   argv(   t   v(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   get_win32_compiler   s    Rz   s   stdc++t   mc          C   s   t  j d  }  |  d  k r d  St j j |  d  }  t j j |   sJ d  Sy t j d c d |  7<Wn t k
 r |  t j d <n Xd  S(   Nt   LIBDIRt	   pkgconfigt   PKG_CONFIG_PATHt   :(	   R    t   get_config_vart   NoneR5   R6   R7   t   isdirt   environt   KeyError(   t   pkgconfig_path(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   set_pkgconfig_path  s    c          C   sl   t  j d  k	 r t  j St j d k r1 t t  _ n4 t d  \ }  } |  d k t  _ t  j re t   n  t  j S(   NR   s   pkg-config --helpi    (   t   has_pkgconfigt   cacheR   R^   R_   t   FalseR   R   (   R%   t   output(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR     s    	
s   --libs --cflagss
   pkg-configc         C   sw  t    s t Si d d 6d d 6d d 6d d 6d	 d
 6} d | | | f } t |  \ } } | d k rOx | j   D] }	 | j |	 d  d  }
 |
 d k	 r%|	 d  d k r t |	 d j d   } t |  d k r | d d f } q n
 |	 d } t |  |
  } | | k rG| j	 |  qGqt |	 |  j
 k rt |  j
 j	 |	  qt qt Wt S| rst d d |  t |  n  t S(   sv   Loosely based on an article in the Python Cookbook:
    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502261R3   s   -It   library_dirss   -Lt	   librariess   -lt   define_macross   -Dt   undef_macross   -Us   %s %s %si    i   R=   i   s
   pkg-configs   looking for %sN(   R   R   R   t   splitt   getR   t   tuplet   lent   getattrR4   t   extra_link_argsR[   RG   RI   (   t   modulet   packagest   flagst   pkg_config_exect   report_errort   _flagsR`   R%   R   t   tokent   attrt   valuet   set(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   get_pkgconfig#  s8    	


c         C   s=   d } t    s | St d |   \ } } | d k r9 | S| S(   Ns*   found, but unknown version (no pkg-config)s   pkg-config %s --modversioni    (   R   R   (   RE   t   defaultR%   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   get_pkgconfig_versionK  s    	c         C   s&   t  |  |  s" |  j j |  n  d  S(   N(   R   R   R4   (   R   RE   t   fallback(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   try_pkgconfigV  s    c         C   s:   x3 |  D]+ } t  j j t  j j | |   r t Sq Wt S(   N(   R5   R6   t   existsR7   R[   R   (   R3   t   filenamet   d(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   find_include_fileZ  s    !c          C   s   t  d g   }  t |   t |  d  se |  j } x0 | D]% } |  j j t j j | d   q9 Wn  t d t	 d   t
 |  j d  s t d d j g  |  j D] } d | ^ q   n  t S(   Nt   testt	   freetype2s
   ft2build.hs9   WARNING: Could not find 'freetype2' headers in any of %s.s   , s   '%s'(   R<   t   add_base_flagsR   R3   R4   R5   R6   R7   RG   R   R   RI   R[   (   R   t   basedirsR   t   x(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_freetype`  s    

&.c          C   s   t  d g   }  t |  d  t |   t d t d   t |  j d  s t d d j g  |  j D] } d | ^ qa   n  t	 S(   NR   t   libpngs   png.hs,   Could not find 'libpng' headers in any of %ss   , s   '%s'(
   R<   R   R   RG   R   R   R3   RI   R7   R[   (   R   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_libpngp  s    
.c         C   s   t  t j j g  t D] } t j j | d  ^ q  } t  t j j g  t D] } t j j | d  ^ qJ g  t D] } t j j | d  ^ qo  } |  j j |  |  j j d  |  j	 j |  d  S(   NR2   t   libt   lib64t   .(
   t   filterR5   R6   R   R   R7   R3   t   extendR4   R   (   R   Ra   t   incdirst   libdirs(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR   }  s    +%,c         C   s   t  j |   j   j   } | S(   s"   get the output of a system command(   R5   t   popenRm   t   strip(   Rv   t   ret(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt	   getoutput  s    c         C   sj   d |  }  g  } xJ t  |   d k r\ |  d  |  d }  } | j d t t | d    q Wd j |  S(   Ns   %xi    ii   R   (   R   t   insertRD   t   intR7   (   R   t   tempt   chunk(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   convert_qt_version  s    
#c          C   s   y d d  l  }  Wn t k
 r1 t d d  t SXy |  j   j } t |  } Wn t k
 rj d } n Xt d d | |  j   j f  t	 Sd  S(   Nit   Qtt   nos	   <unknown>s   Qt: %s, PyQt: %s(
   t
   pyqtconfigt   ImportErrorRG   R   t   Configurationt
   qt_versionR   RP   t   pyqt_version_strR[   (   R   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_qt  s    
	c          C   sm   y d d l  m }  Wn t k
 r5 t d d  t SXt d d t |  j   j  |  j   j f  t	 Sd  S(   Ni(   R   t   Qt4R   s   Qt: %s, PyQt4: %s(
   t   PyQt4R   R   RG   R   R   R   R   R   R[   (   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_qt4  s    	c          C   sh   y$ d d l  m }  d d l  m } Wn t k
 rE t d d  t SXt d d | j |  f  t Sd  S(   Ni(   t   __version__(   t   QtCoret   PySideR   s   Qt: %s, PySide: %s(   R   R   R   R   RG   R   R[   (   R   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_pyside  s    	c          C   sJ   y d d  l  }  Wn t k
 r1 t d d  t SXt d |  j  t Sd  S(   Nit   CairoR   (   t   cairoR   RG   R   R   R[   (   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_cairo  s    c          C   s   t  d t k r! t d d  t Sy d d  l }  Wn= t k
 rp t  d r\ t d d  t St d d  t Sn8 X|  j j d  r t d d  t St d |  j  t Sd  S(   NR   R(   s   matplotlib will provideiR   t   mpl(   t   optionsR[   RG   R(   R   R   R   t   endswith(   R(   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_provide_pytz  s     
c          C   s   t  d t k r! t d d  t Sy d d  l }  Wn= t k
 rp t  d r\ t d d  t St d d  t Sn^ Xy; |  j j d  r t d d  t St d |  j  t SWn t k
 r t d d  t SXd  S(   NR   R)   s   matplotlib will provideiR   R   s   present, version unknown(	   R   R[   RG   R)   R   R   R   R   RP   (   R)   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_provide_dateutil  s(    
c          C   s   t  j d d k  r d  St d t k r8 t d d  t Sy d d  l }  Wn= t k
 r t d rs t d d  t St d d  t Sn^ Xy; |  j j	 d  r t d d  t St d |  j  t SWn t
 k
 r t d d	  t SXd  S(
   Ni    i   R   R*   s   matplotlib will provideiR   R   s   present, version unknown(   R^   t   version_infoR   R[   RG   R*   R   R   R   R   RP   (   R*   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_provide_six  s,    
c          C   sm   yA t  d  \ }  } t d | j   d j   j   d  t SWn% t t f k
 rh t d d  t SXd  S(   Ns   dvipng -versiont   dvipngi   iR   (	   Rb   RG   t	   readlinest   decodeR   R[   t
   IndexErrorRO   R   (   RU   RV   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_dvipng  s    'c          C   s   yU t  j d k r d }  n d }  t |   \ } } t d | j   j   d   t SWn% t t f k
 r| t d d  t	 SXd  S(   NR   s   gswin32c --versions   gs --versiont   ghostscriptiR   (
   R^   R_   Rb   RG   Rm   R   R[   R   RO   R   (   t   commandRU   RV   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_ghostscript  s    	c          C   s   y^ t  d  \ }  } | j   d j   } d } t j | |  } t d | j d   t SWn( t t	 t
 f k
 r t d d  t SXd  S(   Ns   latex -versioni    s   (3\.1\d+)|(MiKTeX \d+.\d+)t   latexR   (   Rb   R   R   t   ret   searchRG   t   groupR[   R   RO   RP   R   (   RU   RV   t   linet   patternt   match(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_latex+  s    c          C   s   y` t  d  \ }  } xG | j   D]9 } | j   } d | k r" t d | j   d  t Sq" WWn% t t f k
 r t d d  t SXd  S(   Ns
   pdftops -vR   t   pdftopsiR   (	   Rb   R   R   RG   R   R[   R   RO   R   (   RU   RV   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_pdftops7  s    c         C   s   y d d  l  } Wn- t k
 r? t d d  t d |   t SXt j |   } t j | j  } | | k s t d |  | j f  t St d g   } t	 |  t
 |  t d | j  t | j t j j d d   s t d  t St S(	   Nit   numpyR   s7   You must install numpy %s or later to build matplotlib.s*   numpy %s or later is required; you have %sR   s   arrayobject.hsW   Could not find the headers for numpy.  You may need to install the development package.(   R   R   RG   RI   R   R   t   LooseVersionR   R   t   add_numpy_flagsR   R   R3   R5   R6   R7   R[   (   t   min_versionR   t   expected_versiont   found_versionR   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_numpyC  s,    

!
c         C   s&   d d l  } |  j j | j    d S(   s9   Add the modules flags to build extensions which use numpyiN(   R   R3   R4   t   get_include(   R   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR   ]  s    c         C   s[   t  |  d d  t |   t |   |  j j d  |  j j d g  |  j j t  d  S(   NR   t   pngt   zR   (   R   R   R   R   R4   R3   R   t   std_libs(   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   add_png_flagsb  s    

c         C   sE   t  |   t |   |  j j d d t d g  |  j j t  d S(   s6   Add the module flags to build extensions which use aggt   srcs
   %s/includeR   N(   R   R   R3   R   t   AGG_VERSIONR   R   (   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   add_agg_flagsj  s    

c         C   sm  t  |   t |  d  s?|  j j d d g  t |   |  j } x | D] } |  j j t j j	 | d   t j j	 | d  } t j j
 |  r |  j j |  n  t j j	 | d  } t j j
 |  rJ |  j j |  qJ qJ W|  j } xe | D]@ } t j j	 | d  } t j j
 |  r |  j j |  q q Wn t |   |  j j d  |  j j t  d S(   s)   Add the module flags to ft2font extensionR   t   freetypeR   s   lib/freetype2/includes   lib/freetype2/include/freetype2s   freetype2/libN(   R   R   R   R   R   R3   R4   R5   R6   R7   R   R   R   (   R   R   R   Ra   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   add_ft2font_flagsu  s*    


  
 
c    	      C   s  t  }  d } y d d l } Wn- t k
 r5 d } nF t k
 rK d } n0 Xd } | j | k  ru d | | j } n t }  |  r t d g   } t |  t	 | j
 t j j d	 d
   s d d j g  | j
 D] } d | ^ q  } t  }  q n  d   } |  rqd d l } t | d  r0| | j  } n d } t d d | | j  | | j  | | j  | f  n t d d  | d k	 rt |  n  |  ry | j t   Wqt k
 rqXn  |  S(   s   check for the presence of pygtkiNsd   Building for Gtk+ requires pygtk; you must be able to "import gtk" in your build/install environments   pygtk present but import failedi   i    sM   Error: GTK backend requires PyGTK %d.%d.%d (or later), %d.%d.%d was detected.R   R,   s   gtk.hs(   Could not find Gtk+ headers in any of %ss   , s   '%s'c         S   s&   d j  g  |  D] } t |  ^ q  S(   NR   (   R7   RD   (   t   tupR   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   ver2str  s    t   pygobject_versions   [pre-pygobject]s   Gtk+s,   gtk+: %s, glib: %s, pygtk: %s, pygobject: %sR   (   i   i   i    (   R   R   R,   R   t   RuntimeErrort   pygtk_versionR[   R<   t   add_pygtk_flagsR   R3   R5   R6   R7   t   gobjectt   hasattrR  RG   t   gtk_versiont   glib_versionRI   t   set_interactiveRP   (	   t   gotitt   explanationR,   R   R   R   R   R  R  (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_gtk  sL    	

!*		c   
      C   sw  t  j d k r|  j j d d g  |  j j d d d d d d	 d
 d d d d d g  t |   d t j k r d t j d <n  t d  j	   } t d  j	   } | | } |  j j g  | D] } | d ^ q  t d  j	   } t d  j	   } | | } |  j
 j g  | D] } | j d  r| d ^ q |  j j g  | D] } | j d  rK| d ^ qK |  j j g  | D]* } | j d  p| j d  s| ^ q t  j d k rt d k rd |  j
 k r|  j
 j d  qn  t  j d k r6t |   t |  d d t }	 |	 s6t d  q6n  t  j d k rst d k rsd |  j
 k rs|  j
 j d  n  d S(   s6   Add the module flags to build extensions which use gtkR   s
   C:/GTK/bins
   C:/GTK/libs   win32_static/include/pygtk-2.0s   C:/GTK/includes   C:/GTK/include/gobjects   C:/GTK/include/gmodules   C:/GTK/include/glibs   C:/GTK/include/pangos   C:/GTK/include/atks   C:/GTK/include/X11s   C:/GTK/include/cairos   C:/GTK/include/gdks   C:/GTK/include/gdk-pixbufs   C:/GTK/include/gtkR   s   C:\GTK\lib\pkgconfigs$   pkg-config --cflags-only-I pygtk-2.0s#   pkg-config --cflags-only-I gtk+-2.0i   s   pkg-config --libs pygtk-2.0s   pkg-config --libs gtk+-2.0s   -ls   -LRz   R~   s   pygtk-2.0 gtk+-2.0R   sA   You may need to install 'dev' package(s) to provide header files.N(   R^   R_   R   R   R3   R   R5   R   R   R   R   t
   startswithR   t   win32_compilerRN   R   R[   RI   (
   R   t   pygtkIncludest   gtkIncludest   includesR2   t   pygtkLinkert	   gtkLinkert   linkerFlagst   flagt   ok(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR    sV    		


'
	-	-	+*
*c          C   s  t  }  d  } y2 t j d d k  r1 d d  l } n d d  l } Wn- t k
 rW d } n5 t k
 rm d } n X| j d k  r d } n t	 }  |  rt
 d g   } y t |  } Wn t k
 r } t |  } qXt | j d	  sd
 d } | d  k	 r| d | 7} n | } t  }  qn  |  r~y | j j   d } Wn t t f k
 rZd } n Xt d d | | j | j f  n t d d  | d  k	 rt |  n  |  S(   Ni    i   is   TKAgg requires Tkinters!   Tkinter present but import failedg @s   Tcl/Tk v8.3 or later requiredR   s   tk.hs1   Tkinter present, but header files are not found. s-   You may need to install development packages.s   
is   version not identifiedt   Tkinters   Tkinter: %s, Tk: %s, Tcl: %sR   (   R   R   R^   R   R  t   tkinterR   R  t	   TkVersionR[   R<   t   add_tk_flagsRD   R   R3   R   R   RP   R   RG   t
   TclVersionRI   (   R
  R  R  R   t   eRH   t   tk_v(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_tk  sJ    	
	
	c          C   sQ   t  }  d d  l } | j d k r* t }  n  |  r@ t d d  n t d d  |  S(   NiR   s   Mac OS X nativet   yesR   (   R   R^   R_   R[   RG   (   R
  R^   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   check_for_macosx?  s    	c          C   s  t  d k	 r t  St j d d k  r2 d d l }  n d d l }  d } d } y |  j   } Wn |  j k
 r:y |  j   } Wn$ t	 k
 r qy|  j k
 r qyXt
 | j d   } t j j |  \ } } | j d d  j d	 d
  } t j j | |  } t j j |  sy| j d d  j d	 d
  } qyn? X| j   t
 | j d   } t
 | j d   } | j   | | t
 |  j  d  f a  t  S(   s@  Tries to open a Tk window in order to query the Tk object about its library paths.
       This should never be called more than once by the same process, as Tk intricacies
       may cause the Python interpreter to hang. The function also has a workaround if
       no X server is running (useful for autobuild systems).i    i   iNt    t   tcl_libraryt   Tclt   Tkt   tclt   tkt
   tk_library(   t   TCL_TK_CACHER   R^   R   R  R  R$  t   TclErrorR#  RP   RD   t   getvarR5   R6   R   t   replaceR7   R   t   withdrawt   destroyR  (   R  t   tcl_lib_dirt
   tk_lib_dirR&  R%  t   headt   tail(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   query_tcltkJ  s8    %

c         C   s^  y2 t  j d d k  r% d d  l } n d d  l } Wn t k
 rF d  SX|  t j j t j j	 |  d   d t
 | j  d g } | t j j t j j	 | d   d t
 | j  d g } xo t | |  D]^ \ } } t j j	 | d  } t j j	 | d	  } t j j |  r t j j |  r Pq q Wt j j |  oNt j j |  sUd  Sd
   }	 |	 | d  j   d d j   }  |	 | d  d j   }
 |	 | d  d j   } |	 | d  j   d d j   } |	 | d  j   } | d k r |
 } n
 | d } |	 | d  d j   } t j j t j j	 | d   sHd  S|  |
 | | | | f S(   Ni    i   is   ..s   /usr/lib/tcls   /usr/libs   /usr/lib/tks   tclConfig.shs   tkConfig.shc         S   sK   t  j d |  | f d t d d d t  j } | j   d } | j d  S(   Ns   . %s ; eval echo ${%s}RT   t
   executables   /bin/shRV   i    t   ascii(   RY   RZ   R[   R\   t   communicateR   (   t   filet   varnameRa   t   result(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   get_var  s    t   TCL_LIB_SPECi   t   TCL_INCLUDE_SPECt   TCL_LIB_FLAGt   TK_LIB_SPECt   TK_INCLUDE_SPECR!  t   TK_LIB_FLAGs   tk.h(   R^   R   R  R  R   R   R5   R6   t   normpathR7   RD   R  R  t   zipR   R   R   (   R.  R/  R  t   tcl_posst   tk_posst   ptclt   ptkt
   tcl_configt	   tk_configR9  t   tcl_inc_dirt   tcl_libt
   tk_inc_dirt   tk_lib(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   parse_tcl_configz  sD    		$$		##	
!c      
   C   s  t  j j |   o! t  j j |  s( d  St  j j t  j j |  d   } t  j j t  j j | d   } t  j j t  j j |  d |   } t  j j |  s t  j j t  j j |  d   } n  t  j j t  j j | d |   } t  j j |  s t  j j t  j j | d   } n  t  j j t  j j | d   sJ| } n  t  j j |  st j j d  rt  j j d  rt  j j d  rd	 } d	 } qn  t  j j t  j j | d   sd  S| | d
 | | | d | f S(   Ns   ../s   ../../include/tcls   ../../includes   ../../include/tks   tk.ht   linuxs   /usr/include/tcl.hs   /usr/include/tk.hs   /usr/includeR%  R&  (	   R5   R6   R   R   R@  R7   R^   R_   R  (   R.  R/  t   tk_verRI  RK  t   tcl_inct   tk_inc(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   guess_tcl_config  s2    $!!!	!c          C   s.   d }  d } d } d } | |  d | | d f S(   Ns   /usr/local/includes   /usr/local/libR%  R&  (    (   RO  RP  RI  RK  (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   hardcoded_tcl_config  s
    c         C   s4  d# } t j d k r7t j \ } } } } } d$ | | f k oJ d% k n r{ |  j j d g  |  j j d d g  n | d k r | d& k r |  j j d
 g  |  j j d d g  nP | d k r| d k r|  j j d g  |  j j d d g  n t d   |  j j t	 j
 j t j d  g  nt j d k rMd d l m } m } | t	 j d  d  d d g }	 d }
 xC |	 D]; } x2 d' D]# } | | | | d   sPqqWd }
 PqW|
 r0g  d( D]) } d) D] } | | | d |  ^ qq} d d d d g } |  j j |  |  j j |  |  j j |  q0n t } y t   \ } } } Wn d  } t   } nU Xt | |  } | d# k rd! } t | | |  } | d# k rd" } t   } qn  | \ } } } } } } |  j j | | g  |  j j | | g  |  j j | | g  | S(*   s5   Add the module flags to build extensions which use tkR   i   i   i   s   win32_static/include/tcl85t   tk85t   tcl85i   i   s   win32_static/include/tcl84t   tk84t   tcl84s   win32_static/include/tcl83t   tk83t   tcl83s/   No tk/win32 support for this python version yett   dllsR   i(   R7   R   t   HOMEs   /Library/Frameworkss   /System/Library/Frameworks/i    R#  R$  s
   .frameworki   t   Headerss   Versions/Current/PrivateHeaderss
   -frameworkR!  s   Guessing the library and include directories for Tcl and Tk because the
tclConfig.sh and tkConfig.sh could not be found and/or parsed.s   Using default library and include directories for Tcl and Tk because a
Tk window failed to open.  You may need to define DISPLAY for Tk to work
so that setup can determine where your libraries are located.N(   i   i   (   i   i   (   i   i   i   (   s   Tcls   Tk(   s   Tcls   Tk(   R[  s   Versions/Current/PrivateHeaders(   R   R^   R_   R   R3   R   R   R  R   R5   R6   R7   t   prefixt   os.pathR   t   getenvR   t   extra_compile_argsR   R2  RR  RL  RQ  (   R   RH   t   majort   minor1t   minor2Rv   t   tmpR7   R   t   framework_dirst   tk_framework_foundt   Ft   fwt   Ht   tk_include_dirst
   frameworkst   successR.  R/  RN  R8  RH  RI  RJ  RK  (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR    sh    "(	
)c         C   sM   |  j  j d g  |  j j d g  |  j j d g  |  j j d  d S(   s<   Add the module flags to build extensions using windowing apis
   C:/includet   user32s   C:/libs	   -mwindowsN(   R3   R   R   R   R   R4   (   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   add_windowing_flagsA  s    c         C   s=   t  r
 d St d d g  } t |  |  j |  t a  d S(   sr   windowing is optional and provides functions for managing
       windows better, .e.g.  maintaining focus on win32Ns   matplotlib._windowings   src/_windowing.cpp(   t   BUILT_WINDOWINGR<   Rm  R4   R[   (   t   ext_modulesR   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR   H  s     
c         C   sx   t  r
 d  Sd d g } | j t j d   | j t j d   t d | d t } t |  |  j |  t a  d  S(   Ns   src/ft2font.cpps   src/mplutils.cpps	   CXX/*.cxxs   CXX/*.cs   matplotlib.ft2fontR   (   t   BUILT_FT2FONTR   t   globR<   t   definesR   R4   R[   (   Ro  R   t   depsR   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   build_ft2fontT  s     	
c         C   sR   t  r
 d  Sd d d d g } t d | d t } t |  |  j |  t a  d  S(   Ns   src/_ttconv.cpps   ttconv/pprdrv_tt.cpps   ttconv/pprdrv_tt2.cpps   ttconv/ttutil.cpps   matplotlib.ttconvR   (   t   BUILT_TTCONVR<   Rr  R   R4   R[   (   Ro  R   Rs  R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   build_ttconva  s     		
c         C   s   t  r
 d  Sd d d g } | j t j d   | j t j d   t d | d t } t |  t |  t |  t |  |  j	 |  t
 a  d  S(   Ns   src/agg_py_transforms.cpps   src/_gtkagg.cpps   src/mplutils.cpps	   CXX/*.cxxs   CXX/*.cs   matplotlib.backends._gtkaggR   (   t   BUILT_GTKAGGR   Rq  R<   Rr  R   R   R  R   R4   R[   (   Ro  R   Rs  R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR   o  s     	



c         C   s   t  r
 d  Sd d g } | j t j d   | j t j d   t d | d t } t |  t |  t |  |  j |  t	 a  d  S(   Ns   src/agg_py_transforms.cpps   src/_tkagg.cpps	   CXX/*.cxxs   CXX/*.cs   matplotlib.backends._tkaggR   (
   t   BUILT_TKAGGR   Rq  R<   Rr  R  R   R   R4   R[   (   Ro  R   Rs  R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR     s     	


c         C   sq   t  r
 d  Sd d d d d d d g } t d | d	 d
 d g d t } t |  t |  |  j |  t a  d  S(   Ns   src/_macosx.ms   CXX/cxx_extensions.cxxs   CXX/cxxextensions.cs   CXX/cxxsupport.cxxs   CXX/IndirectPythonInterface.cxxs   src/agg_py_transforms.cpps   src/path_cleanup.cpps   matplotlib.backends._macosxR   s
   -frameworkt   CocoaR   (   t   BUILT_MACOSXR<   Rr  R   R   R4   R[   (   Ro  R   Rs  R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR     s"     		

c         C   s~   t  r
 d  Sd d g } | j t j d   | j t j d   t d | d t d t } t |  |  j |  t a  d  S(   Ns   src/_png.cpps   src/mplutils.cpps	   CXX/*.cxxs   CXX/*.cs   matplotlib._pngR3   R   (	   t	   BUILT_PNGR   Rq  R<   t   numpy_inc_dirsRr  R   R4   R[   (   Ro  R   Rs  R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt	   build_png  s     	
c         C   s   t  r
 d  Sd } g  | D] } d t | f ^ q } | j d d	 g  | j t j d
   | j t j d   t d d  | j d  t d | d t d t } t	 |  t
 |  t |  |  j |  t a  d  S(   Ns   agg_trans_affine.cpps   agg_bezier_arc.cpps   agg_curves.cpps   agg_vcgen_dash.cpps   agg_vcgen_stroke.cpps   agg_image_filters.cpps	   %s/src/%ss   src/mplutils.cpps   src/agg_py_transforms.cpps	   CXX/*.cxxs   CXX/*.cs   src/_backend_agg.cpps   src/backend_agg.cpps    matplotlib.backends._backend_aggR3   R   (   s   agg_trans_affine.cpps   agg_bezier_arc.cpps   agg_curves.cpps   agg_vcgen_dash.cpps   agg_vcgen_stroke.cpps   agg_image_filters.cpp(   t	   BUILT_AGGR   R   Rq  Rx   R4   R<   R|  Rr  R   R   R   R[   (   Ro  R   t   aggRd   Rs  R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR     s0          #	


c         C   s   t  r
 d  Sd } g  | D] } d t | f ^ q } | j t j d   | j t j d   t d	 d
  | j d d d
 g  t d | d t d t } t |  t	 |  |  j
 |  t a  d  S(   Ns   agg_vcgen_contour.cpps   agg_curves.cpps   agg_bezier_arc.cpps   agg_trans_affine.cpps   agg_vcgen_stroke.cpps	   %s/src/%ss	   CXX/*.cxxs   CXX/*.cs   src/_path.cpps   src/path.cpps   src/agg_py_transforms.cpps   src/path_cleanup.cpps   matplotlib._pathR3   R   (   s   agg_vcgen_contour.cpps   agg_curves.cpps   agg_bezier_arc.cpps   agg_trans_affine.cpps   agg_vcgen_stroke.cpp(   t
   BUILT_PATHR   R   Rq  Rx   R<   R|  Rr  R   R   R4   R[   (   Ro  R   R  Rd   Rs  R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt
   build_path  s.         #	
	

c         C   s   t  r
 d  Sd } t d d  d d g } | j g  | D] } d t | f ^ q6  | j t j d   | j t j d	   t d
 | d t d t } t |  t	 |  |  j
 |  t a  d  S(   Ns   agg_trans_affine.cpps   agg_image_filters.cpps   agg_bezier_arc.cpps   src/_image.cpps   src/image.cpps   src/mplutils.cpps	   %s/src/%ss	   CXX/*.cxxs   CXX/*.cs   matplotlib._imageR3   R   (   s   agg_trans_affine.cpps   agg_image_filters.cpps   agg_bezier_arc.cpp(   t   BUILT_IMAGERx   R   R   Rq  R<   R|  Rr  R   R   R4   R[   (   Ro  R   R  Rs  Rd   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyR     s&       *	

c         C   s   t  r
 d  Sd d d d g } g  | D] } t j j d |  ^ q# } t d | d t d t } t |  t |  |  j	 |  | j
 d	 g  t a  d  S(
   Ns   _delaunay.cpps   VoronoiDiagramGenerator.cpps   delaunay_utils.cpps   natneighbors.cpps   lib/matplotlib/delaunays   matplotlib._delaunayR3   R   s   matplotlib.delaunay(   t   BUILT_DELAUNAYR5   R6   R7   R<   R|  Rr  R   R   R4   R   R[   (   Ro  R   t   sourcefilesRv   t   delaunay(    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   build_delaunay$  s    (	

c         C   sS   t  r
 d  St d d g d t d t } t |  t |  |  j |  t a  d  S(   Ns   matplotlib._cntrs
   src/cntr.cR3   R   (   t   BUILT_CONTOURR<   R|  Rr  R   R   R4   R[   (   Ro  R   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   build_contour7  s     		

c      	   C   sp   t  r
 d  St d d  t d d g d g  d t d t } t |  t |  t |  |  j |  t	 a  d  S(   Ns   src/_backend_gdk.cs   src/backend_gdk.cs    matplotlib.backends._backend_gdkR   R3   R   (
   t	   BUILT_GDKRx   R<   R|  Rr  R   R   R  R4   R[   (   Ro  R   R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt	   build_gdkH  s     		


c         C   s   t  r
 d  Sd d g } | j t j d   | j t j d   t d | d t } t |  t |  |  j |  t a  d  S(   Ns   lib/matplotlib/tri/_tri.cpps   src/mplutils.cpps	   CXX/*.cxxs   CXX/*.cs   matplotlib._triR   (	   t	   BUILT_TRIR   Rq  R<   Rr  R   R   R4   R[   (   Ro  R   Rs  R   (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt	   build_tri]  s     	

(   R   R    (   R!   R"   (   R#   R"   (    (}   Rj   R5   R   RY   t	   distutilsR    R   t   collectionsR   R^  t   basedirR^   t   textwrapR   t   distutils.coreR   Rq  R   t   ConfigParsert   configparsert	   cStringIOR   R_   t   commandsR   t   ioR   R{  R~  Rp  Ru  Rw  R  Rz  Rx  Rn  R  R  R  R  R  R   R   R(  R|  R[   R   Rr  R4   R   R   t	   setup_cfgR6   R   t   SafeConfigParsert   configRm   t
   getbooleanR   R   R<   R?   RG   RI   RK   RL   RS   Rb   Rc   Rx   R}   R  R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R  R  R   R2  RL  RQ  RR  R  Rm  R   Rt  Rv  R   R   R   R}  R   R  R   R  R  R  R  (    (    (    s\   /mbari/ProjectLibrary/707976 EPBuoyPrototypeAndTesting/Portugal/matplotlib-1.2.0/setupext.pyt   <module>,   sv  



	       	  	             
		
														$												
														7	B	7		0	3	#		j									!	"				