
6	Pc           @   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 d0 d 6d0 d 6d1 d	 6d1 d 6d2 d 6d3 d 6d. d 6d4 6i d* d 6d* d 6d+ d	 6d+ d 6d, d 6d- d 6d. d 6d5 6i d6 d 6d6 d 6d7 d	 6d7 d 6d8 d 6d- d 6d. d 6d9 6Z dZ Z e j j	   d: Z
 e j d;  Z e
 d: 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 dA j   k re e j j 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   Z e   Z e r[x- d[ D]" Z  dE e e  d <dF e e  d <q2Wn  dG   Z! dH   Z" dI   Z# dJ   Z$ dK   Z% d dL  Z& dM   Z' dN   Z( dO   Z) d dP  Z* dQ   Z+ dR   Z, dS   Z- e$   d e. dT  Z/ e$   d e. dU  Z0 dV   Z1 dW   Z2 dX   Z3 dY   Z4 d S(\   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_prefixs)   {base}/local/lib/python{py_version_short}s-   {platbase}/local/lib/python{py_version_short}s7   {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\vis   \pcbuild\amd64ic          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   (   s   posixs   nt(   t   NoneR0   t   get_config_varst   _INSTALL_SCHEMESR*   R   t   nameR   t
   expandusert   normpathR(   (   t   schemet   varst   resR.   R/   (    (    s   /usr/lib/python2.7/sysconfig.pyt   _expand_vars   s    	#c           C   s   t  j d k r d St  j S(   NR1   R   (   R   R5   (    (    (    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 | 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   R6   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   getR2   R5   t   syst   platformt   get_config_vart   version_info(   t   env_baseR?   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 Wx^| rxQ| j   D]C} | | } | j |  p| j |  } | r| j d  } t } | | k rt | |  } nB | | k rt } n- | t j k rt j | } n d | | <} | r| | j   } | | j    | | } d | k re| | | <qy t
 |  } Wn! t k
 r| j   | | <n X| | | <| | =qqt| | =qtWqa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   ret   compileR2   t   opent	   readlinest
   startswitht   stript   matcht   groupt   replacet   intt
   ValueErrorR)   t   searchR   t   strR   R   R#   t   endt   startR*   t
   isinstancet   update(   t   filenameR9   RR   t   _variable_rxt   _findvar1_rxt   _findvar2_rxt   donet   notdonet   ft   linest   linet   mt   nt   vt   tmpvR5   R/   t   foundt   itemt   aftert   k(    (    s   /usr/lib/python2.7/sysconfig.pyt   _parse_makefile   sp    	!	
	 
c           C   sW   t  r t j j t d  St j j t d  j d d d  d t j rL d pO d d  S(	   Nt   MakefileR   s
   /usr/locals   /usri   t   configt   _dRP   (	   t   _PYTHON_BUILDR   R   R   R   t   get_pathRZ   RG   t   pydebug(    (    (    s   /usr/lib/python2.7/sysconfig.pyt   _get_makefile_filename&  s    c         C   s  t    } y t | |   WnL t k
 rh } d | } t | d  rY | 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 S(   s7   Initialize the module as appropriate for POSIX systems.s.   invalid Python installation: unable to open %st   strerrors    (%s)Nt	   BLDSHAREDt   LDSHARED(	   R{   Rt   t   IOErrort   hasattrR|   t   get_config_h_filenameRT   t   parse_config_hRx   (   R9   t   makefilet   et   msgt   config_hRi   (    (    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(   Ry   t   _PY_VERSION_SHORT_NO_DOTR   R   t   dirnameR   RG   t
   executable(   R9   (    (    s   /usr/lib/python2.7/sysconfig.pyt   _init_non_posixI  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    (	   RR   R2   RS   R   t   readlineRX   RY   R[   R\   (	   t   fpR9   RR   t	   define_rxt   undef_rxRk   Rl   Rm   Rn   (    (    s   /usr/lib/python2.7/sysconfig.pyR   Y  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   Rw   RP   s
   pyconfig.h(
   Rx   R   R5   R   R   R   Ry   RZ   RG   Rz   (   t   inc_dir(    (    s   /usr/lib/python2.7/sysconfig.pyR   v  s    	.c          C   s    t  j   }  |  j   t |   S(   s-   Returns a tuple containing the schemes names.(   R4   R)   t   sortt   tuple(   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;   R4   (   R8   R9   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   (   R5   R8   R9   R   (    (    s   /usr/lib/python2.7/sysconfig.pyRy     s    c          G   sH  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 <d t k r t t d <n  t rut j	 d k rut } y t j   } Wn t k
 rd } n Xt j j t d  ru| | k rut j j | t d  } t j j |  t d <qun  t j d k r	t j   d } t | j d  d  } | d k  rxGd# D]D } t | } | j d d |  } | j d d |  } | t | <qWqd t j k rrt j d }	 xH d$ D]= } t | } | j d d |  } | d |	 } | t | <q.Wn  t j d d  }
 | j d |
  } | d k	 r| j d   } t j j |  sx: d% D]/ } t | } | j d! d |  } | t | <qWqq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_nodotRL   t   platbaset   projectbaseR   R   R1   t   userbaset   srcdirRC   t   .i   t   LDFLAGSt
   BASECFLAGSt   CFLAGSt	   PY_CFLAGSR}   s   -arch\s+\w+\st    s   -isysroot [^ 	]*t	   ARCHFLAGSRP   s   -isysroot\s+(\S+)i   s   -isysroot\s+\S+(\s|$)(   s   nts   os2(   s   LDFLAGSs
   BASECFLAGSs   CFLAGSs	   PY_CFLAGSs	   BLDSHARED(   s   LDFLAGSs
   BASECFLAGSs   CFLAGSs	   PY_CFLAGSs	   BLDSHARED(   s   LDFLAGSs
   BASECFLAGSs   CFLAGSs	   PY_CFLAGSs	   BLDSHARED(    RR   t   _CONFIG_VARSR2   t   _PREFIXt   _EXEC_PREFIXt   _PY_VERSIONt   _PY_VERSION_SHORTR   R   R5   R   R   RN   Rx   t   getcwdR   R   t   isabsR   R7   RG   RH   t   unameR[   t   splitt   subR#   RF   R]   RY   t   existst   append(   R>   RR   RL   t   cwdR   t   kernel_versiont   major_versionR.   t   flagst   archR   Rl   t   sdkt   valsR5   (    (    s   /usr/lib/python2.7/sysconfig.pyR3     s|    














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)
    (   R3   RF   (   R5   (    (    s   /usr/lib/python2.7/sysconfig.pyRI     s    c          C   sg  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 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 r=d | |	 f S| d  d k r| d d k rVd } d t | d  d | d f } qVn| d  d k rd | | f S| d  d k rd | | | f S| d  d  k rd  } |  j d!  }
 |
 j |  } | rV| j   } qVn@| d  d" k rVt   } | j d#  } | } y t d$  } Wn t k
 rgnc XzT |  j d% d& | j    } | d k	 rd' j | j d(  j d'  d   } n  Wd | j   X| s| } n  | rV| } d) } | d' d* k rd+ t   j d, d  j   k rd- }	 t   j d,  } |  j d. |  } t t t |    } t |  d( k r}| d }	 qP| d< k rd- }	 qP| d= k rd2 }	 qP| d> k rd3 }	 qP| d? k rd5 }	 qP| d@ k rd6 }	 qPt d7 | f   qS|	 d/ k r#t j  dA k rPd1 }	 qPqS|	 dB k rSt j  dC k rGd4 }	 qPd0 }	 qSqVn  d; | | |	 f S(D   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-ia64R1   R   t   /RP   R   t   _t   -i   t   linuxs   %s-%st   sunosi    t   5t   solariss   %d.%si   i   i   t   irixt   aixs   %s-%s.%si   t   cygwins   [\d.]+RC   t   MACOSX_DEPLOYMENT_TARGETs0   /System/Library/CoreServices/SystemVersion.plists'   <key>ProductUserVisibleVersion</key>\s*s   <string>(.*?)</string>R   i   t   macosxs   10.4.s   -archR   t   fats   -arch\s+(\S+)t   i386t   ppct   x86_64t   intelt   fat3t   ppc64t   fat64t	   universals%   Don't know machine value for archs=%ri    t   PowerPCt   Power_Macintoshs   %s-%s-%s(   s   i386s   ppc(   s   i386s   x86_64(   s   i386s   ppcs   x86_64(   s   ppc64s   x86_64(   s   i386s   ppcs   ppc64s   x86_64l        (   s   PowerPCs   Power_Macintoshl        (!   RR   R   R5   RG   t   versiont   findRH   t   lent   lowerR   R   RZ   R[   RS   RX   RY   R3   RF   RT   R   R]   t   readR2   R   R   t   closeRW   t   findallR   t   sortedt   setR\   t   maxint(   RR   R   t   it   jt   lookt   osnamet   hostt   releaseR   t   machinet   rel_reRl   t   cfgvarst   macvert
   macreleaseRi   t   cflagst   archs(    (    s   /usr/lib/python2.7/sysconfig.pyt   get_platform!  s     (	,	!						c           C   s   t  S(   N(   R   (    (    (    s   /usr/lib/python2.7/sysconfig.pyt   get_python_version  s    (   s   stdlibs
   platstdlibs   purelibs   platlibs   includes   scriptss   data(   s   posix_prefixs   posix_locals
   deb_systems
   posix_home(5   t   __doc__RG   R   t   os.pathR    R   R4   R   R   R   R   R   R   R   R7   R   R   R   R   R2   R   t
   _USER_BASER   R   R   R   R   R5   R   R   R    Rx   R8   R(   R0   R;   R<   RN   Rt   R{   R   R   R   R   R   R   R   R   Ry   R3   RI   R   R   (    (    (    s   /usr/lib/python2.7/sysconfig.pyt   <module>   s   		%%!%!									V							|		