Viewing File: /usr/lib/python3.6/site-packages/pip/_vendor/distlib/_backport/__pycache__/sysconfig.cpython-36.pyc

3

�PfKi�@s�dZddlZddlZddlZddlZddlmZmZyddlZWne	k
r\ddl
ZYnXdddddd	d
ddd
dgZdd�Zej
r�ejjeej
��Zneej��Zejdkr�dedEd�j�kr�eejjee��Zejdko�dedFd�j�k�r
eejjeee��Zejdk�r@dedGd�j�k�r@eejjeee��Zdd�Ze�Zdadd�Zej�Zejd�Zdd�Zejj�dZ ejdd �Z!e de d!Z"ejj#ej$�Z%ejj#ej&�Z'da(dZ)d"d#�Z*d$d%�Z+d&d'�Z,d(d)�Z-d*d+�Z.d,d-�Z/dHd.d/�Z0d0d�Z1d1d2�Z2d3d4�Z3dId5d�Z4d6d�Z5d7d
�Z6d8d	�Z7e.�dd9fd:d
�Z8e.�dd9fd;d�Z9d<d�Z:d=d�Z;d>d�Z<d?d�Z=d@dA�Z>dBdC�Z?e@dDk�r�e?�dS)Jz-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_hcCs"yt|�Stk
r|SXdS)N)r�OSError)�path�r�/usr/lib/python3.6/sysconfig.py�_safe_realpath"sr�ntZpcbuild�z\pc\v�
z\pcbuild\amd64�cCs.x(dD] }tjjtjjtd|��rdSqWdS)N�
Setup.dist�Setup.local�ModulesTF)rr)�osr�isfile�join�
_PROJECT_BASE)�fnrrr�is_python_build:s
r FcCs�ts�ddlm}tjdd�d}||�}|jd�}|s>td��|j��}tj	|�WdQRXt
r�x(dD] }tj|d
d�tj|dd
�qfWdadS)N�)�finder�.�rz
sysconfig.cfgzsysconfig.cfg exists�posix_prefix�
posix_home�includez{srcdir}/Include�platincludez{projectbase}/.T)r%r&)�	_cfg_readZ	resourcesr"�__name__�rsplit�find�AssertionErrorZ	as_stream�_SCHEMESZreadfp�
_PYTHON_BUILD�set)r"Zbackport_packageZ_finderZ_cfgfile�s�schemerrr�_ensure_cfg_readDs


r3z\{([^{]*?)\}cs�t�|jd�r|jd�}nt�}|j�}xD|D]<}|dkr>q0x,|D]$\}}|j||�rZqD|j|||�qDWq0W|jd�xX|j�D]L}t|j|����fdd�}x,|j|�D]\}}|j||t	j
||��q�Wq�WdS)N�globalscs$|jd�}|�kr�|S|jd�S)Nr$r)�group)�matchobj�name)�	variablesrr�	_replaceros
z"_expand_globals.<locals>._replacer)r3Zhas_section�items�tuple�sectionsZ
has_optionr0Zremove_section�dict�	_VAR_REPL�sub)�configr4r<ZsectionZoption�valuer9r)r8r�_expand_globalsYs$


rB�r!cs�fdd�}tj||�S)z�In the string `path`, replace tokens like {some.thing} with the
    corresponding value from the map `local_vars`.

    If there is no corresponding value, leave the token unchanged.
    cs8|jd�}|�kr�|S|tjkr.tj|S|jd�S)Nr$r)r5r�environ)r6r7)�
local_varsrrr9�s


z_subst_vars.<locals>._replacer)r>r?)rrEr9r)rEr�_subst_vars�srFcCs4|j�}x&|j�D]\}}||kr$q|||<qWdS)N)�keysr:)�target_dict�
other_dict�target_keys�keyrArrr�_extend_dict�s
rLcCsdi}|dkri}t|t��xBtj|�D]4\}}tjdkrFtjj|�}tjjt	||��||<q(W|S)N�posixr)rMr)
rLrr.r:rr7r�
expanduser�normpathrF)r2�vars�resrKrArrr�_expand_vars�s
rRcs�fdd�}tj||�S)Ncs$|jd�}|�kr�|S|jd�S)Nr$r)r5)r6r7)rPrrr9�s
zformat_value.<locals>._replacer)r>r?)rArPr9r)rPr�format_value�srScCstjdkrdStjS)NrMr%)rr7rrrr�_get_default_scheme�s
rTcCs�tjjdd�}dd�}tjdkrBtjjd�p.d}|r8|S||d�Stjdkr|td	�}|r||r`|S|dd
|dtjdd��S|r�|S|dd
�SdS)N�PYTHONUSERBASEcWstjjtjj|��S)N)rrrNr)�argsrrr�joinuser�sz_getuserbase.<locals>.joinuserr�APPDATA�~�Python�darwin�PYTHONFRAMEWORK�Libraryz%d.%dr!z.local)rrD�getr7�sys�platformr�version_info)�env_baserW�base�	frameworkrrr�_getuserbase�s"



recCs"tjd�}tjd�}tjd�}|dkr*i}i}i}tj|ddd��}|j�}WdQRXx�|D]�}	|	jd�s\|	j�d	krxq\|j|	�}
|
r\|
jd
d�\}}|j�}|j	dd	�}
d
|
kr�|||<q\yt
|�}Wn$tk
r�|j	dd
�||<Yq\X|||<q\Wt|j
��}d}�x�t|�dk�r�x�t|�D�]�}||}|j|��pJ|j|�}
|
dk	�r�|
jd
�}d}||k�r|t||�}n�||k�r�d}nx|tjk�r�tj|}n`||k�r�|jd��r�|dd�|k�r�d	}n$d||k�r�d}nt|d|�}nd	||<}|�r�||
j�d�}|d|
j��||}d
|k�rF|||<n~yt
|�}Wn"tk
�rt|j�||<Yn
X|||<|j|�|jd��r�|dd�|k�r�|dd�}||k�r�|||<n|||<|j|��q(W�qWx.|j�D]"\}}t|t��r�|j�||<�q�W|j|�|S)z�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.
    z"([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_]*)}Nzutf-8�surrogateescape)�encoding�errors�#�r$r!z$$�$�CFLAGS�LDFLAGS�CPPFLAGSrTF�PY_rC)rlrmrn)�re�compile�codecs�open�	readlines�
startswith�strip�matchr5�replace�int�
ValueError�listrG�lenr;�search�strrrD�end�start�remover:�
isinstance�update)�filenamerP�_variable_rx�_findvar1_rx�_findvar2_rx�done�notdone�f�lines�line�m�n�v�tmpvr8�renamed_variablesr7rA�found�item�after�krrr�_parse_makefile�s�	
















r�cCsDtrtjjtd�Sttd�r,dttjf}nd}tjjt	d�|d�S)z Return the path of the Makefile.�Makefile�abiflagszconfig-%s%sr@�stdlib)
r/rrrr�hasattrr_�_PY_VERSION_SHORTr�r)�config_dir_namerrrrMs
cCs�t�}yt||�WnJtk
r^}z.d|}t|d�rF|d|j}t|��WYdd}~XnXt�}y"t|��}t||�WdQRXWnJtk
r�}z.d|}t|d�r�|d|j}t|��WYdd}~XnXtr�|d|d<dS)z7Initialize the module as appropriate for POSIX systems.z.invalid Python installation: unable to open %s�strerrorz (%s)N�	BLDSHARED�LDSHARED)	rr��IOErrorr�r�rrsrr/)rP�makefile�e�msg�config_hr�rrr�_init_posixXs&


r�cCsVtd�|d<td�|d<td�|d<d|d<d	|d
<t|d<tjjttj��|d<d
S)z+Initialize the module as appropriate for NTr��LIBDEST�
platstdlib�
BINLIBDESTr'�	INCLUDEPYz.pyd�SOz.exe�EXE�VERSION�BINDIRN)r�_PY_VERSION_SHORT_NO_DOTrr�dirnamerr_�
executable)rPrrr�_init_non_posixtsr�cCs�|dkri}tjd�}tjd�}xx|j�}|s0P|j|�}|rz|jdd�\}}yt|�}Wntk
rnYnX|||<q"|j|�}|r"d||jd�<q"W|S)z�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.
    Nz"#define ([A-Z][A-Za-z0-9_]+) (.*)
z&/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/
r$r!r)rprq�readlinerwr5ryrz)�fprP�	define_rx�undef_rxr�r�r�r�rrrr�s(




cCs:tr$tjdkrtjjtd�}q,t}ntd�}tjj|d�S)zReturn the path of pyconfig.h.r�PCr(z
pyconfig.h)r/rr7rrrr)�inc_dirrrrr�s
cCstttj���S)z,Return a tuple containing the schemes names.)r;�sortedr.r<rrrrr
�scCs
tjd�S)z*Return a tuple containing the paths names.r%)r.Zoptionsrrrrr	�sTcCs&t�|rt||�Sttj|��SdS)z�Return 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)r3rRr=r.r:)r2rP�expandrrrr
�s
cCst|||�|S)z[Return a path corresponding to the scheme.

    ``scheme`` is the install scheme name.
    )r
)r7r2rPr�rrrr�scGs�tdk�r�iattd<ttd<ttd<ttd<tdtdtd<ttd	<ttd
<ttd<ytjtd<Wntk
r�d
td<YnXt	j
d#kr�tt�t	j
dkr�tt�tj
dkr�t�td<dtkr�ttd<nttd�td<to�t	j
dk�r\t}yt	j�}Wntk
�rd}YnXt	jjtd��r\||k�r\t	jj|td�}t	jj|�td<tjdk�r�t	j�d}t|jd�d�}|dk�r�x:d$D]2}t|}tjdd|�}tjdd|�}|t|<�q�Wn�dt	jk�rt	jd}x8d%D]0}t|}tjdd|�}|d|}|t|<�q�Wtjdd
�}	tjd |	�}
|
dk	�r�|
j d!�}t	jj!|��s�x,d&D]$}t|}tjd"d|�}|t|<�q^W|�r�g}x|D]}
|j"tj|
���q�W|StSdS)'ayWith 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.
    N�prefix�exec_prefix�
py_version�py_version_shortrr!�py_version_nodotrc�platbase�projectbaser�rjr�os2rMz2.6�userbase�srcdirr[r#rrm�
BASECFLAGSrl�	PY_CFLAGSr�z
-arch\s+\w+\s� z-isysroot [^ 	]*Z	ARCHFLAGSz-isysroot\s+(\S+)r$z-isysroot\s+\S+(\s|$))rr�)rmr�rlr�r�)rmr�rlr�r�)rmr�rlr�r�)#�_CONFIG_VARS�_PREFIX�_EXEC_PREFIX�_PY_VERSIONr�rr_r��AttributeErrorrr7r�r��versionrerr/�getcwdrr�isabsrrOr`�unamery�splitrpr?rDr^r}r5�exists�append)rVrc�cwdr�Zkernel_versionZ
major_versionrK�flagsZarchrlr�Zsdk�valsr7rrrr�s�












cCst�j|�S)z�Return the value of a single variable using the dictionary returned by
    'get_config_vars()'.

    Equivalent to get_config_vars().get(name)
    )rr^)r7rrrrRscCs`tjdkrnd}tjj|�}|d:kr(tjStjjd|�}tj|t|�|�j�}|dkr\dS|dkrhdStjStjd	ks�ttd
�r�tjStj	�\}}}}}|j�j
dd�}|j
d
d�}|j
dd�}|dd�dkr�d||fS|dd�dk�r(|ddk�rRd}dt|d�d|dd�f}�n*|dd�dk�rFd||fS|dd�dk�rfd|||fS|dd�d k�r�d }tj
d!�}	|	j|�}
|
�rR|
j�}�n�|dd�d"k�rRt�}|jd#�}|}
ytd$�}Wntk
�r�YnJXztjd%|j��}
Wd|j�X|
dk	�r4d&j|
jd�jd&�dd��}
|�s>|
}|�rR|}d'}|
d&d(k�rd)t�jd*d�j�k�rd+}t�jd*�}tjd,|�}ttt|���}t|�dk�r�|d}n^|d;k�r�d+}nN|d<k�r�d0}n>|d=k�r�d1}n.|d>k�r�d3}n|d?k�rd4}ntd5|f��n<|d-k�r2tjd@k�rRd/}n |dAk�rRtjdBk�rNd2}nd.}d9|||fS)Ca�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'.
    rz bit (r$�)�amd64z	win-amd64�itaniumzwin-ia64rMr��/rjr��_�-N��linuxz%s-%s�sunosr�5�solarisz%d.%srCr!��irix�aixz%s-%s.%s��cygwinz[\d.]+r[�MACOSX_DEPLOYMENT_TARGETz0/System/Library/CoreServices/SystemVersion.plistz=<key>ProductUserVisibleVersion</key>\s*<string>(.*?)</string>r#Zmacosxz10.4.z-archrlZfatz
-arch\s+(\S+)�i386�ppc�x86_64ZintelZfat3�ppc64Zfat64Z	universalz%Don't know machine value for archs=%r� �PowerPC�Power_Macintoshz%s-%s-%s���)r�r�)r�r�)r�r�r�)r�r�)r�r�r�r�l)r�r�l) rr7r_r�r,r`r|�lowerr�r�rxryrprqrwr5rr^rsr�r}�read�closerr�rv�findallr;r�r0rz�maxsize)r��i�j�look�osname�host�releaser��machine�rel_rer�ZcfgvarsZmacverZ
macreleaser�ZcflagsZarchsrrrr[s�
$












cCstS)N)r�rrrrr�scCsJxDtt|j���D]0\}\}}|dkr2td|�td||f�qWdS)Nrz%s: z
	%s = "%s")�	enumerater�r:�print)�title�data�indexrKrArrr�_print_dictsrcCsRtdt��tdt��tdt��t�tdt��t�tdt��dS)z*Display all information sysconfig detains.zPlatform: "%s"zPython version: "%s"z!Current installation scheme: "%s"�Paths�	VariablesN)r�rrrTrr
rrrrr�_mainsr�__main__i����i����i�)N)N)A�__doc__rrrrpr_Zos.pathrrZconfigparser�ImportErrorZConfigParser�__all__rr�rr�rr�r7r�rr r/r)r3ZRawConfigParserr.rqr>rBr�r�r�r�r�rOr�r�r�r�r��
_USER_BASErFrLrRrSrTrer�rr�r�rrr
r	r
rrrrrrrr*rrrr�<module>s� "
#
	
v

	#

Back to Directory File Manager
<