
bc           @   s"  d  Z  d d l Z d d l Z d d l m Z m Z i
 i d d 6d d 6d d	 6d
 d 6d d 6d d 6d d 6d d 6d 6i d d 6d d 6d d	 6d d 6d d 6d d 6d d 6d d 6d 6i d d 6d d 6d d	 6d d 6d d 6d d 6d d 6d d 6d 6i d d 6d d 6d d	 6d d 6d  d 6d  d 6d d 6d d 6d! 6i d" d 6d" d 6d# d	 6d# d 6d$ d 6d$ d 6d% d 6d d 6d& 6i d" d 6d" d 6d# d	 6d# d 6d$ d 6d$ d 6d% d 6d d 6d' 6i d( d 6d( d 6d) d	 6d) d 6d* d 6d+ d 6d, d 6d- 6i d. d 6d. d 6d/ d	 6d/ d 6d0 d 6d1 d 6d, d 6d2 6i d( d 6d( d 6d) d	 6d) d 6d* d 6d+ d 6d, d 6d3 6i d4 d 6d4 d 6d5 d	 6d5 d 6d6 d 6d+ d 6d, d 6d7 6Z d` Z e j j	   d8 Z
 e j d9  Z e
 d8 e
 d: Z e j j e j  Z e j j e j  Z d a d Z d;   Z e j r2e j j e e j   Z n e e j    Z e j d& k rd< e d= j   k re e j j e e   Z n  e j d& k rd> e d? j   k re e j j e e e   Z n  e j d& k r`e j j e j j e j j e    j   d@ k r`e j j e j j e   j   dA k r`e e j j e e e e   Z n  e j d& k rdB e dC j   k re e j j e e e   Z n  dD e j k re j j e j j  dE   Z n  dF   Z! e!   Z" e" rx- da D]" Z# dG e e# d <dH e e# d <qWn  dI   Z$ dJ   Z% dK   Z& dL   Z' dM   Z( d dN  Z) dO   Z* e* Z+ dP   Z, dQ   Z- dR   Z. d dS  Z/ dT   Z0 dU   Z1 dV   Z2 e'   d e3 dW  Z4 e'   d e3 dX  Z5 dY   Z6 dZ   Z7 d[   Z8 d\   Z9 d]   Z: d^   Z; e< d_ k re;   n  d S(b   s7   Provide access to Python's configuration information.

iN(   t   pardirt   realpaths#   {base}/lib/python{py_version_short}t   stdlibs'   {platbase}/lib/python{py_version_short}t
   platstdlibs1   {base}/lib/python{py_version_short}/site-packagest   purelibs5   {platbase}/lib/python{py_version_short}/site-packagest   platlibs'   {base}/include/python{py_version_short}t   includes+   {platbase}/include/python{py_version_short}t   platincludes
   {base}/bint   scriptss   {base}t   datat   posix_prefixs7   {base}/local/lib/python{py_version_short}/dist-packagess;   {platbase}/local/lib/python{py_version_short}/dist-packagess-   {base}/local/include/python{py_version_short}s1   {platbase}/local/include/python{py_version_short}s   {base}/local/bins   {base}/localt   posix_locals1   {base}/lib/python{py_version_short}/dist-packagess5   {platbase}/lib/python{py_version_short}/dist-packagest
   deb_systems   {base}/lib/pythons   {base}/include/pythont
   posix_homes
   {base}/Libs   {base}/Lib/site-packagess   {base}/Includes   {base}/Scriptst   ntt   os2s'   {userbase}/lib/python{py_version_short}s5   {userbase}/lib/python{py_version_short}/site-packagess+   {userbase}/include/python{py_version_short}s   {userbase}/bins
   {userbase}t   os2_homes#   {userbase}/Python{py_version_nodot}s1   {userbase}/Python{py_version_nodot}/site-packagess+   {userbase}/Python{py_version_nodot}/Includes   {userbase}/Scriptst   nt_usert
   posix_users   {userbase}/lib/pythons#   {userbase}/lib/python/site-packagess   {userbase}/includet   osx_framework_useri    i   i   c         C   s'   y t  |   SWn t k
 r" |  SXd  S(   N(   R   t   OSError(   t   path(    (    s   /usr/lib/python2.7/sysconfig.pyt   _safe_realpathu   s    t   pcbuildis   \pc\vit   pcs   vs9.0s   \pcbuild\amd64it   _PYTHON_PROJECT_BASEt   .c          C   s=   x6 d D]. }  t  j j t  j j t d |    r t Sq Wt S(   Ns
   Setup.dists   Setup.localt   Modules(   s
   Setup.dists   Setup.local(   t   osR   t   isfilet   joint   _PROJECT_BASEt   Truet   False(   t   fn(    (    s   /usr/lib/python2.7/sysconfig.pyt   is_python_build   s    $s   {projectbase}/Includes   {srcdir}c         C   sc   y |  j  |   SWnK t k
 r^ y |  j  t j   SWq_ t k
 rZ } t d |   q_ Xn Xd  S(   Ns   {%s}(   t   formatt   KeyErrorR   t   environt   AttributeError(   t   st
   local_varst   var(    (    s   /usr/lib/python2.7/sysconfig.pyt   _subst_vars   s    c         C   sI   |  j    } x6 | j   D]( \ } } | | k r7 q n  | |  | <q Wd  S(   N(   t   keyst   items(   t   target_dictt
   other_dictt   target_keyst   keyt   value(    (    s   /usr/lib/python2.7/sysconfig.pyt   _extend_dict   s
    c         C   s   i  } | d  k r i  } n  t | t    xa t |  j   D]O \ } } t j d k rl t j j |  } n  t j j	 t
 | |   | | <q< W| S(   Nt   posixR   (   R4   R   (   t   NoneR3   t   get_config_varst   _INSTALL_SCHEMESR-   R   t   nameR   t
   expandusert   normpathR+   (   t   schemet   varst   resR1   R2   (    (    s   /usr/lib/python2.7/sysconfig.pyt   _expand_vars   s    	#c           C   s   t  j d k r d St  j S(   NR4   R   (   R   R8   (    (    (    s   /usr/lib/python2.7/sysconfig.pyt   _get_default_scheme   s    c          C   s   t  j j d d   }  d   } t  j d k r\ t  j j d  pB d } |  rO |  S| | d  St j d k r t d  } | r |  r |  S| d d	 | d
 t j d   Sn  |  r |  S| d d  S(   Nt   PYTHONUSERBASEc          W   s   t  j j t  j j |     S(   N(   R   R   R9   R   (   t   args(    (    s   /usr/lib/python2.7/sysconfig.pyt   joinuser   s    R   t   APPDATAt   ~t   Pythont   darwint   PYTHONFRAMEWORKt   Librarys   %d.%di   s   .local(	   R   R&   t   getR5   R8   t   syst   platformt   get_config_vart   version_info(   t   env_baseRB   t   baset	   framework(    (    s   /usr/lib/python2.7/sysconfig.pyt   _getuserbase   s    	
c         C   s  d d l  } | j d  } | j d  } | j d  } | d k rN i  } n  i  } i  } t |    } | j   }	 Wd QXx |	 D] }
 |
 j d  s |
 j   d k r q n  | j |
  } | r | j d d	  \ } } | j   } | j	 d
 d  } d | k r| | | <qZy t
 |  } Wn' t k
 rL| j	 d
 d  | | <qZX| | | <q q Wt | j    } d } x/t |  d k rxt |  D]} | | } | j |  p| j |  } | d k	 r| j d  } t } | | k rt | |  } n | | k rt } n | t j k r:t j | } nr | | k r| j d  rn| d | k rnd } qd | | k rt } qt | d |  } n d | | <} | r| | j   } | | j    | | } d | k r| | | <qy t
 |  } Wn! t k
 r&| j   | | <n X| | | <| j |  | j d  r| d | k r| d } | | k r| | | <qqqq| | | <| j |  qWqyWx< | j   D]. \ } } t | t  r| j   | | <qqW| j |  | S(   s   Parse a Makefile-style file.

    A dictionary containing name/value pairs is returned.  If an
    optional dictionary is passed in as the second argument, it is
    used instead of a new dictionary.
    iNs"   ([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)s   \$\(([A-Za-z][A-Za-z0-9_]*)\)s   \${([A-Za-z][A-Za-z0-9_]*)}t   #t    i   i   s   $$t   $t   CFLAGSt   LDFLAGSt   CPPFLAGSi    t   PY_i   (   RU   RV   RW   (   t   ret   compileR5   t   opent	   readlinest
   startswitht   stript   matcht   groupt   replacet   intt
   ValueErrort   listR,   t   lent   tuplet   searchR    t   strR!   R   R&   t   endt   startt   removeR-   t
   isinstancet   update(   t   filenameR<   RY   t   _variable_rxt   _findvar1_rxt   _findvar2_rxt   donet   notdonet   ft   linest   linet   mt   nt   vt   tmpvt	   variablest   renamed_variablesR8   R2   t   foundt   itemt   aftert   k(    (    s   /usr/lib/python2.7/sysconfig.pyt   _parse_makefile   s    	!
			


c           C   s2   t  r t j j t d  St j j t d  d  S(   s    Return the path of the Makefile.t   Makefilet   LIBPL(   t   _PYTHON_BUILDR   R   R   R   RL   (    (    (    s   /usr/lib/python2.7/sysconfig.pyt   get_makefile_filenameQ  s    c       	   C   s;  d d l  }  i  } t   } y t | |  WnL t k
 rz } d | } t | d  rk | d | j } n  t |   n Xt   } y& t |   } t | |  Wd QXWnL t k
 r } d | } t | d  r | d | j } n  t |   n Xt	 r| d | d <n  d } d	 t
 j k rYd d l } | j |  }	 | |	 _ |	 t
 j | <n  d
 t   t
 j d  f }
 t t
 d  r|
 d 7}
 n  y t j |
  Wn t k
 rn Xt j j |
 | d  } t | d  4 } | j d  | j d  |  j  | d | Wd QXt d d   } | j |
  Wd QXd S(   s;   Generate the Python module containing build-time variables.iNs.   invalid Python installation: unable to open %st   strerrors    (%s)t	   BLDSHAREDt   LDSHAREDt   _sysconfigdataRF   s   build/lib.%s-%si   t   gettotalrefcounts   -pydebugs   .pyt   wbsB   # system configuration generated and used by the sysconfig module
s   build_time_vars = t   streams   pybuilddir.txtt   w(   t   pprintR   R   t   IOErrort   hasattrR   t   get_config_h_filenameR[   t   parse_config_hR   RJ   RK   t   impt
   new_modulet   build_time_varst   modulest   get_platformt   versionR   t   makedirsR   R   R   t   write(   R   R<   t   makefilet   et   msgt   config_hRt   R8   R   t   modulet
   pybuilddirt   destfile(    (    s   /usr/lib/python2.7/sysconfig.pyt   _generate_posix_varsZ  sR    	
	
	c         C   s!   d d l  m } |  j |  d S(   s7   Initialize the module as appropriate for POSIX systems.i(   R   N(   R   R   Rm   (   R<   R   (    (    s   /usr/lib/python2.7/sysconfig.pyt   _init_posix  s    c         C   sq   t  d  |  d <t  d  |  d <t  d  |  d <d |  d <d	 |  d
 <t |  d <t j j t t j   |  d <d S(   s+   Initialize the module as appropriate for NTR   t   LIBDESTR   t
   BINLIBDESTR   t	   INCLUDEPYs   .pydt   SOs   .exet   EXEt   VERSIONt   BINDIRN(   t   get_patht   _PY_VERSION_SHORT_NO_DOTR   R   t   dirnameR   RJ   t
   executable(   R<   (    (    s   /usr/lib/python2.7/sysconfig.pyt   _init_non_posix  s    


c   	      C   s   d d l  } | d k r! i  } n  | j d  } | j d  } x t r |  j   } | s^ Pn  | j |  } | r | j d d  \ } } y t |  } Wn t k
 r n X| | | <qB | j |  } | rB d | | j d  <qB qB W| S(   s   Parse a config.h-style file.

    A dictionary containing name/value pairs is returned.  If an
    optional dictionary is passed in as the second argument, it is
    used instead of a new dictionary.
    iNs"   #define ([A-Z][A-Za-z0-9_]+) (.*)
s&   /[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/
i   i   i    (	   RY   R5   RZ   R    t   readlineR_   R`   Rb   Rc   (	   t   fpR<   RY   t	   define_rxt   undef_rxRv   Rw   Rx   Ry   (    (    s   /usr/lib/python2.7/sysconfig.pyR     s*    		  c          C   sw   t  r6 t j d k r- t j j t d  }  qd t }  n. t d  j d d d  t j	 r] d p` d }  t j j |  d	  S(
   s   Returns the path of pyconfig.h.R   t   PCR   s
   /usr/locals   /usri   t   _dRS   s
   pyconfig.h(
   R   R   R8   R   R   R   R   Ra   RJ   t   pydebug(   t   inc_dir(    (    s   /usr/lib/python2.7/sysconfig.pyR     s    	.c          C   s    t  j   }  |  j   t |   S(   s-   Returns a tuple containing the schemes names.(   R7   R,   t   sortRf   (   t   schemes(    (    s   /usr/lib/python2.7/sysconfig.pyt   get_scheme_names  s    
c           C   s   t  S(   s+   Returns a tuple containing the paths names.(   t   _SCHEME_KEYS(    (    (    s   /usr/lib/python2.7/sysconfig.pyt   get_path_names  s    c         C   s   | r t  |  |  St |  Sd S(   s   Returns a mapping containing an install scheme.

    ``scheme`` is the install scheme name. If not provided, it will
    return the default scheme for the current platform.
    N(   R>   R7   (   R;   R<   t   expand(    (    s   /usr/lib/python2.7/sysconfig.pyt	   get_paths  s    c         C   s   t  | | |  |  S(   s\   Returns a path corresponding to the scheme.

    ``scheme`` is the install scheme name.
    (   R   (   R8   R;   R<   R   (    (    s   /usr/lib/python2.7/sysconfig.pyR     s    c    	      G   s  d d l  } t d k ri  a t t d <t t d <t t d <t t d <t d t d t d	 <t t d
 <t t d <t t d <t j	 d k r t
 t  n  t j	 d k r t t  n  t   t d <t d  } | r d | t d <n
 d t d <d t k rt t d <n  t rt j	 d k rt } y t j   } Wn t k
 rId } n Xt j j t d  r| | k rt j j | t d  } t j j |  t d <qn  t j d k rd d l } | j t  qn  |  rg  } x$ |  D] } | j t j |   qW| St Sd S(   sy  With no arguments, return a dictionary of all configuration
    variables relevant for the current platform.

    On Unix, this means every variable defined in Python's installed Makefile;
    On Windows and Mac OS it's a much smaller set.

    With arguments, return a list of values that result from looking up
    each argument in the configuration variable dictionary.
    iNt   prefixt   exec_prefixt
   py_versiont   py_version_shorti    i   t   py_version_nodotRO   t   platbaset   projectbaseR   R   R4   t   userbaset	   MULTIARCHt   /t   multiarchsubdirRS   t   srcdirRF   (   R   R   (   RY   t   _CONFIG_VARSR5   t   _PREFIXt   _EXEC_PREFIXt   _PY_VERSIONt   _PY_VERSION_SHORTR   R   R8   R   R   RQ   RL   R   t   getcwdR   R   t   isabsR   R:   RJ   RK   t   _osx_supportt   customize_config_varst   appendRI   (	   RA   RY   t	   multiarchRO   t   cwdR   R   t   valsR8   (    (    s   /usr/lib/python2.7/sysconfig.pyR6     sR    









c         C   s   t    j |   S(   s   Return the value of a single variable using the dictionary returned by
    'get_config_vars()'.

    Equivalent to get_config_vars().get(name)
    (   R6   RI   (   R8   (    (    s   /usr/lib/python2.7/sysconfig.pyRL   E  s    c          C   s  d d l  }  t j d k r d } t j j |  } | d k rF t j St j j d |  } t j | t |  | !j   } | d k r d S| d k r d	 St j Sd
 t j	 k r t j	 d
 St j d k s t
 t d  r t j St j   \ } } } } }	 | j   j d d  } |	 j d d  }	 |	 j d d  }	 | d  d k rWd | |	 f S| d  d k r| d d k rd } d t | d  d | d f } i d d 6d d 6}
 |	 d  |
 t j 7}	 qn | d!  d" k rd | | f S| d  d# k rd$ | | | f S| d%  d& k rYd& } |  j d'  } | j |  } | r| j   } qnC | d%  d( k rd d l } | j t   | | |	  \ } } }	 n  d) | | |	 f S(*   s  Return a string that identifies the current platform.

    This is used mainly to distinguish platform-specific build directories and
    platform-specific built distributions.  Typically includes the OS name
    and version and the architecture (as supplied by 'os.uname()'),
    although the exact information included depends on the OS; eg. for IRIX
    the architecture isn't particularly important (IRIX only runs on SGI
    hardware), but for Linux the kernel version isn't particularly
    important.

    Examples of returned values:
       linux-i586
       linux-alpha (?)
       solaris-2.6-sun4u
       irix-5.3
       irix64-6.2

    Windows will return one of:
       win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
       win-ia64 (64bit Windows on Itanium)
       win32 (all others - specifically, sys.platform is returned)

    For other non-POSIX platforms, currently just returns 'sys.platform'.
    iNR   s    bit (t   )t   amd64s	   win-amd64t   itaniums   win-ia64t   _PYTHON_HOST_PLATFORMR4   t   unameR   RS   t    t   _t   -i   t   linuxs   %s-%st   sunosi    t   5t   solariss   %d.%si   i   t   32bitit   64bitIs   .%si   t   irixt   aixs   %s-%s.%si   t   cygwins   [\d.]+RF   s   %s-%s-%s(   RY   R   R8   RJ   R   t   findRK   Re   t   lowerR&   R   R   Ra   Rb   t   maxintRZ   R_   R`   R   t   get_platform_osxR6   (   RY   R   t   it   jt   lookt   osnamet   hostt   releaseR   t   machinet   bitnesst   rel_reRw   R   (    (    s   /usr/lib/python2.7/sysconfig.pyR   M  sZ     "c           C   s   t  S(   N(   R   (    (    (    s   /usr/lib/python2.7/sysconfig.pyt   get_python_version  s    c         C   sZ   xS t  t | j     D]9 \ } \ } } | d k rC d |  GHn  d | | f GHq Wd  S(   Ni    s   %s: s
   	%s = "%s"(   t	   enumeratet   sortedR-   (   t   titleR	   t   indexR1   R2   (    (    s   /usr/lib/python2.7/sysconfig.pyt   _print_dict  s    +c           C   sd   d t  j k r t   d Sd t   GHd t   GHd t   GHHt d t    Ht d t    d S(   s*   Display all information sysconfig detains.s   --generate-posix-varsNs   Platform: "%s"s   Python version: "%s"s!   Current installation scheme: "%s"t   Pathst	   Variables(	   RJ   t   argvR   R   R   R?   R   R   R6   (    (    (    s   /usr/lib/python2.7/sysconfig.pyt   _main  s    t   __main__(   R   R   R   R   R   R   R	   (   R
   R   R   R   (=   t   __doc__RJ   R   t   os.pathR    R   R7   R   R   t   splitR   R   R   R   R:   R   R   R   R   R5   R   t
   _USER_BASER   R   R   R   R   R8   R   R   t   basenameR&   t   abspathR#   R   R;   R+   R3   R>   R?   RQ   R   R   t   _get_makefile_filenameR   R   R   R   R   R   R   R    R   R   R6   RL   R   R   R   R   t   __name__(    (    (    s   /usr/lib/python2.7/sysconfig.pyt   <module>   s$   		%%!6*$%!!									w		D						M		\			