???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................
Yf_                 @   s  d  Z  d d l Z d d l Z d d l m Z m Z d d d d d d	 d
 d d d d g Z d d d d d d d d d d d d d d d d d i d  d d! d d" d d" d d" d d# d d# d d d d i d$ d d% d d& d d' d d' d d( d d( d d) d d i d* d d+ d d+ d d, d d, d d- d d. d d/ i d0 d d1 d d1 d d2 d d3 d d4 d d5 d d/ i d6 d d7 d d7 d d8 d d8 d d9 d d5 d d/ i i Z dl Z e j	 j
   d Z e j	 d d:  Z e d e d; Z e j j e j  Z e j j e j  Z e j j e j  Z e j j e j  Z d a d Z d< d=   Z e j rde j j e e j   Z n e e j    Z e j d$ k re j    j! dm  re e j j" e e e   Z d@ e j# k re e j# d@  Z dA dB   Z$ e% e dC d  Z& e& r@e j d$ k r@e& j    j! dn  r@e j j e j j e&   Z& dD dE dF  Z' e' dG  Z( e( rx* do D]" Z) dH e e) d <dI e e) d <qhWdJ dK   Z* dL dM   Z+ dN dO   Z, dP dQ   Z- dR dS   Z. d dT dU  Z/ dV d   Z0 dW dX   Z1 dY dZ   Z2 d[ d\   Z3 d d] d  Z4 d^ d   Z5 d_ d   Z6 d` d	   Z7 e-   d dG da d
  Z8 e-   d dG db d  Z9 dc d   Z: dd d   Z; de d   Z< df d   Z= dg dh   Z> di dj   Z? e@ dk k re?   d S)pz-Access to Python's configuration information.    N)pardirrealpathget_config_h_filenameget_config_varget_config_varsget_makefile_filenameget_pathget_path_names	get_pathsget_platformget_python_versionget_scheme_namesparse_config_hposix_prefixstdlibz/{installed_base}/lib64/python{py_version_short}
platstdlibz){platbase}/lib64/python{py_version_short}purelibz1{base}/lib/python{py_version_short}/site-packagesplatlibz7{platbase}/lib64/python{py_version_short}/site-packagesincludez;{installed_base}/include/python{py_version_short}{abiflags}platincludez?{installed_platbase}/include/python{py_version_short}{abiflags}scriptsz
{base}/bindataz{base}
posix_homez{installed_base}/lib/pythonz{base}/lib/pythonz{installed_base}/include/pythonntz{installed_base}/Libz
{base}/Libz{base}/Lib/site-packagesz{installed_base}/Includez{base}/Scriptsnt_userz#{userbase}/Python{py_version_nodot}z1{userbase}/Python{py_version_nodot}/site-packagesz+{userbase}/Python{py_version_nodot}/Includez+{userbase}/Python{py_version_nodot}/Scriptsz
{userbase}
posix_userz){userbase}/lib64/python{py_version_short}z5{userbase}/lib/python{py_version_short}/site-packagesz7{userbase}/lib64/python{py_version_short}/site-packagesz+{userbase}/include/python{py_version_short}z{userbase}/binosx_framework_userz{userbase}/lib/pythonz#{userbase}/lib/python/site-packagesz{userbase}/include      c             C   s+   y t  |   SWn t k
 r& |  SYn Xd  S)N)r   OSError)path r!   ./opt/alt/python35/lib64/python3.5/sysconfig.py_safe_realpathc   s    r#   \pcbuild\win32\pcbuild\amd64Z_PYTHON_PROJECT_BASEc             C   s=   x6 d D]. } t  j j t  j j |  d |   r d Sq Wd S)N
Setup.distSetup.localModulesTF)r&   r'   )osr    isfilejoin)dfnr!   r!   r"   _is_python_source_dirx   s    $r.   _homeFc             C   s    |  r t  r t t   St t  S)N)	_sys_homer.   _PROJECT_BASE)
check_homer!   r!   r"   is_python_build   s    
r3   Tz{srcdir}/Includez{projectbase}/.c             C   sv   y |  j  |   SWn^ t k
 rq y |  j  t j   SWn5 t k
 rl } z t d |   WYd  d  } ~ Xn XYn Xd  S)Nz{%s})formatKeyErrorr)   environAttributeError)s
local_varsvarr!   r!   r"   _subst_vars   s    r;   c             C   sF   |  j    } x3 | j   D]% \ } } | | k r4 q | |  | <q Wd  S)N)keysitems)target_dict
other_dicttarget_keyskeyvaluer!   r!   r"   _extend_dict   s
    rC   c             C   s   i  } | d  k r i  } t  | t    x^ t |  j   D]L \ } } t j d k rf t j j |  } t j j t	 | |   | | <q9 W| S)Nposixr   )rD   r   )
rC   r   _INSTALL_SCHEMESr=   r)   namer    
expandusernormpathr;   )schemevarsresrA   rB   r!   r!   r"   _expand_vars   s    #rL   c               C   s   t  j d k r d St  j S)NrD   r   )r)   rF   r!   r!   r!   r"   _get_default_scheme   s    rM   c              C   s   t  j j d d   }  d d   } t  j d k r_ t  j j d  pE d } |  rR |  S| | d  St j d k r t d	  } | r |  r |  S| d d
 | d t j d  d   S|  r |  S| d d  Sd  S)NPYTHONUSERBASEc              W   s   t  j j t  j j |     S)N)r)   r    rG   r+   )argsr!   r!   r"   joinuser   s    z_getuserbase.<locals>.joinuserr   APPDATA~PythondarwinPYTHONFRAMEWORKLibraryz%d.%dr   z.local)r)   r6   getrF   sysplatformr   version_info)env_baserP   base	frameworkr!   r!   r"   _getuserbase   s"    r^   c             C   sm  d d l  } | j d  } | j d  } | j d  } | d k rK i  } i  } i  } t |  d d  } | j   }	 Wd QRXx |	 D] }
 |
 j d  s |
 j   d	 k r q | j |
  } | r | j d
 d  \ } } | j   } | j d d	  } d | k r| | | <q y t	 |  } Wn( t
 k
 rN| j d d  | | <Yq X| | | <q Wt | j    } d } xt |  d k rxt |  D]} | | } | j |  } | j |  } | r| r| j   | j   k  r| n | } n | r| n | } | d k	 r| j d
  } d } | | k rJt | |  } n | | k r_d } n | t j k r~t j | } nx | | k r| j d  r| d d  | k rd	 } qd | | k rd } qt | d |  } n d	 | | <} | r| | j   d  } | d | j    } | j   | k rD| | 7} | | 7} d | k rg| | | <qy t	 |  } Wn" t
 k
 r| j   | | <Yn X| | | <| j |  | j d  r| d d  | k r| d d  } | | k r| | | <q| | | <| j |  qWqxWx9 | j   D]+ \ } } t | t  r-| j   | | <q-W| j |  | S)zParse 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.
    r   Nz"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)z\$\(([A-Za-z][A-Za-z0-9_]*)\)z\${([A-Za-z][A-Za-z0-9_]*)}errorssurrogateescape#    r   z$$$CFLAGSLDFLAGSCPPFLAGSTFPY_r   )re   rf   rg   )recompileopen	readlines
startswithstripmatchgroupreplaceint
ValueErrorlistr<   lentuplesearchstartstrr)   r6   endremover=   
isinstanceupdate)filenamerJ   ri   _variable_rx_findvar1_rx_findvar2_rxdonenotdoneflineslinemnvtmpv	variablesrenamed_variablesrF   rB   m1m2founditemafterkr!   r!   r"   _parse_makefile   s    	!
'			



r   c              C   sf   t  r t j j t p t d  St t d  rD d t t j	 f }  n d }  t j j t
 d  |  d  S)z Return the path of the Makefile.Makefileabiflagszconfig-%s%sconfigr   )_PYTHON_BUILDr)   r    r+   r0   r1   hasattrrX   _PY_VERSION_SHORTr   r   )config_dir_namer!   r!   r"   r   O  s    c           ,   C   sS  d d l  }  i  } t   } y t | |  Wn[ t k
 r } z; d | } t | d  rk | d | j } t |   WYd d } ~ Xn Xt   } y' t |   } t | |  Wd QRXWn[ t k
 r} z; d | } t | d  r | d | j } t |   WYd d } ~ Xn Xt	 r,| d | d <d } d	 t
 j k rrd d l } | j |  }	 | |	 _ |	 t
 j | <d
 t   t
 j d d  f }
 t t
 d  r|
 d 7}
 t j |
 d d t j j |
 | d  } t | d d d 4 } | j d  | j d  |  j  | d | Wd QRXt d d d d  } | j |
  Wd QRXd S)z;Generate the Python module containing build-time variables.r   Nz.invalid Python installation: unable to open %sstrerrorz (%s)LDSHARED	BLDSHARED_sysconfigdatarT   zbuild/lib.%s-%sr   gettotalrefcountz-pydebugexist_okTz.pywencodingutf8zB# system configuration generated and used by the sysconfig module
zbuild_time_vars = streamzpybuilddir.txtascii)pprintr   r   r   r   r   r   rk   r   r   rX   rY   types
ModuleTypebuild_time_varsmodulesr   versionr)   makedirsr    r+   write)r   rJ   makefileemsgconfig_hr   rF   r   module
pybuilddirdestfiler!   r!   r"   _generate_posix_varsY  sL    	
	
	 
r   c             C   s!   d d l  m } |  j |  d S)z7Initialize the module as appropriate for POSIX systems.r   )r   N)r   r   r}   )rJ   r   r!   r!   r"   _init_posix  s    r   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)z+Initialize the module as appropriate for NTr   LIBDESTr   
BINLIBDESTr   	INCLUDEPYz.pyd
EXT_SUFFIXz.exeEXEVERSIONBINDIRN)r   _PY_VERSION_SHORT_NO_DOTr)   r    dirnamer#   rX   
executable)rJ   r!   r!   r"   _init_non_posix  s    


r   c       	      C   s   | d k r i  } d d l  } | j d  } | j d  } x |  j   } | sR P| j |  } | r | j d d  \ } } y t |  } Wn t k
 r Yn X| | | <q? | j |  } | r? d | | j d  <q? W| S)zParse 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.
    Nr   z"#define ([A-Z][A-Za-z0-9_]+) (.*)
z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/
rc   r   )ri   rj   readlinero   rp   rr   rs   )	fprJ   ri   	define_rxundef_rxr   r   r   r   r!   r!   r"   r     s*    c              C   sa   t  rB t j d k r3 t j j t p' t d  }  qN t p< t }  n t d  }  t j j |  d  S)zReturn the path of pyconfig.h.r   PCr   zpyconfig-64.h)r   r)   rF   r    r+   r0   r1   r   )inc_dirr!   r!   r"   r     s    c               C   s   t  t t   S)z,Return a tuple containing the schemes names.)rv   sortedrE   r!   r!   r!   r"   r     s    c               C   s   t  S)z*Return a tuple containing the paths names.)_SCHEME_KEYSr!   r!   r!   r"   r	     s    c             C   s   | r t  |  |  St |  Sd S)zReturn 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)rL   rE   )rI   rJ   expandr!   r!   r"   r
     s    c             C   s   t  | | |  |  S)z[Return a path corresponding to the scheme.

    ``scheme`` is the install scheme name.
    )r
   )rF   rI   rJ   r   r!   r!   r"   r     s    c              G   s  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 t  d <t t  d <y t j	 t  d <Wn t
 k
 r d t  d <Yn Xt j d k r t t   t j d k r t t   t  j d  } | d k	 r	| t  d <t   t  d <t  j d t  } t j d k rt rjt j j t    } t j j | |  } n t j j t    } t |  t  d <t j d k rd d l } | j t   |  rg  } x$ |  D] } | j t  j |   qW| St  Sd S)an  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 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.
    Nprefixexec_prefix
py_versionpy_version_shortr   r   py_version_nodotinstalled_baser\   installed_platbaseplatbaseprojectbaser   rb   r   rD   r   SOuserbasesrcdirrT   )_CONFIG_VARS_PREFIX_EXEC_PREFIX_PY_VERSIONr   _BASE_PREFIX_BASE_EXEC_PREFIXr1   rX   r   r7   r)   rF   r   r   rW   r^   r   r    r   r   r+   r#   rY   _osx_supportcustomize_config_varsappend)rO   r   r   r\   r   valsrF   r!   r!   r"   r     sP    











c             C   s;   |  d k r+ d d l  } | j d t d  t   j |   S)zReturn the value of a single variable using the dictionary returned by
    'get_config_vars()'.

    Equivalent to get_config_vars().get(name)
    r   r   Nz SO is deprecated, use EXT_SUFFIXr   )warningswarnDeprecationWarningr   rW   )rF   r   r!   r!   r"   r   E  s    c              C   s  t  j d k r d }  t j j |   } | d* k r: 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 Sd t  j	 k r t  j	 d St  j
   \ } } } } } | j   j d d  } | j d d  } | j d d  } | d d  d k rTd | | f S| d d  d k r| d d k rd } d t | d  d | d d  f } d d d d i }	 | d  |	 t j 7} n | d d!  d" k rd | | f S| d d  d# k rd$ | | | f S| d d%  d& k rxd& } d d l }
 |
 j d'  } | j |  } | r| j   } nF | d d%  d( k rd d l } | j t   | | |  \ } } } d) | | | f S)+a  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'.
    r   z bit (rc   )amd64z	win-amd64itaniumzwin-ia64rD   uname_PYTHON_HOST_PLATFORM/rb    _-N   linuxz%s-%ssunosr   5solarisz%d.%sr   r   i32bitl    64bitz.%s   irixaixz%s-%s.%s   cygwinz[\d.]+rT   z%s-%s-%s)r)   rF   rX   r   findrY   ru   lowerr   r6   r   rq   rr   maxsizeri   rj   ro   rp   r   get_platform_osxr   )r   ijlookosnamehostreleaser   machinebitnessri   rel_rer   r   r!   r!   r"   r   Q  sZ    #(c               C   s   t  S)N)r   r!   r!   r!   r"   r     s    c             C   sa   xZ t  t | j     D]@ \ } \ } } | d k rE t d |   t d | | f  q Wd  S)Nr   z%s: z
	%s = "%s")	enumerater   r=   print)titler   indexrA   rB   r!   r!   r"   _print_dict  s    +r  c               C   s   d t  j k r t   d St d t    t d t    t d t    t   t d t    t   t d t	    d S)z*Display all information sysconfig detains.z--generate-posix-varsNzPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"Paths	Variables)
rX   argvr   r  r   r   rM   r  r
   r   r!   r!   r!   r"   _main  s    r  __main__)r   r   r   r   r   r   r   )r$   r%   )r$   r%   )r   r   )A__doc__r)   rX   Zos.pathr   r   __all__rE   r   r   splitr   r   r   r    rH   r   r   base_prefixr   r   r   base_exec_prefixr   r   
_USER_BASEr#   r   r   r1   getcwdrF   r   endswithr+   r6   r.   getattrr0   r3   r   rI   r;   rC   rL   rM   r^   r   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r  r  __name__r!   r!   r!   r"   <module>   s   						 		
? M[