3 NO�j�N� @s�dZddlZddlZddlZddlZddlmZejjej �Z ejjej �Z ejjej �Zejjej�Zdejkr�ejjejd�Znejjejjej��Zejdkr�ej�jd,�r�ejjejje��Zd d �Zeed d�Zeo�ejdko�ej�jd-��rejjejje��Zd d �Ze�ZdZye�s.ejZWne k �rFYnXdd�Z!d.dd�Z"d/dd�Z#dd�Z$dd�Z%dd�Z&d0dd�Z'ej(d�Z)ej(d�Z*ej(d�Z+d1d d!�Z,d"d#�Z-da.d$d%�Z/d&d'�Z0d(d)�Z1d*d+�Z2dS)2a�Provide access to Python's configuration information. The specific configuration variables available depend heavily on the platform and configuration. The values may be retrieved using get_config_var(name), and the list of variables is available via get_config_vars().keys(). Additional convenience functions are also available. Written by: Fred L. Drake, Jr. Email: �N�)�DistutilsPlatformErrorZ_PYTHON_PROJECT_BASE�nt�\pcbuild\win32�\pcbuild\amd64cCs.x(dD] }tjjtjj|d|��rdSqWdS)N� Setup.dist� Setup.local�ModulesTF)rr)�os�path�isfile�join)�d�fn�r�+/usr/lib64/python3.6/distutils/sysconfig.py�_is_python_source_dir)s r�_homecCstr tt�Stt�S)N)� _sys_homer� project_baserrrr� _python_build2sr�cCsdtjdd�S)z�Return a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'. z%d.%dN�)�sys� version_inforrrr�get_python_versionDsrcCs�|dkr|rtpt}tjdkrjtrL|r.tp,tStjjt d�d�}tjj |�Sdt �t }tjj|d|�Stjdkr�tjj|d�St dtj��dS) a�Return the directory containing installed Python header files. If 'plat_specific' is false (the default), this is the path to the non-platform-specific header files, i.e. Python.h and so on; otherwise, this is the path to platform-specific header files (namely pyconfig.h). If 'prefix' is supplied, use it instead of sys.base_prefix or sys.base_exec_prefix -- i.e., ignore 'plat_specific'. N�posix�srcdirZInclude�python�includerzFI don't know where Python installs its C header files on platform '%s')�BASE_EXEC_PREFIX� BASE_PREFIXr �name� python_buildrrr r �get_config_var�normpathr� build_flagsr)� plat_specific�prefixZincdirZ python_dirrrr�get_python_incLs     r)cCs�|dkr&|r|rtpt}n |r"tp$t}tjdkrp|s8|r>d}nd}tjj||dt��}|r`|Stjj|d�SnrAZccZcxx�optZcflagsZccsharedZldsharedZ shlib_suffix�arZar_flagsZnewccZcppr?Zcc_cmdrrrrB�s\                         rBcCsDtr,tjdkr"tjjtptd�}q6tp(t}n tdd�}tjj|d�S)z2Return full pathname of installed pyconfig.h file.r�PCr)r'z pyconfig-64.h)r#r r"r r rrr))�inc_dirrrr�get_config_h_filename�s    rLcCs\trtjjtptd�Stddd�}djt�t �}t t j d�rL|dt j j 7}tjj||d�S)zAReturn full pathname of installed Makefile from the Python build.�Makefilerr)r'r.z config-{}{}� _multiarchz-%s)r#r r r rrr/�formatrr&�hasattrr�implementationrN)Zlib_dirZ config_filerrr�get_makefile_filename�s  rRc Cs�|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_]+) [*]/ rrr)�re�compile�readline�match�group�int� ValueError)�fp�g� define_rx�undef_rx�line�m�n�vrrr�parse_config_h�s(      rbz"([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_]*)}c Cs�ddlm}||ddddd�}|dkr*i}i}i}x�|j�}|dkrFPtj|�}|r4|jdd�\}} | j�} | jdd �} d | kr�| ||<q4y t| �} Wn$t k r�| jdd �||<Yq4X| ||<q4Wd} �x�|�r��x�t |�D�]�} || } t j | ��pt j | �}|�rx|jd�}d}||k�r2t||�}n�||k�rBd}nx|tjk�rZtj|}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�r�| || <nzy t| �} Wn"t k �r*| j�|| <Yn X| || <|| =| jd��r~| dd�| k�r~| dd�} | |k�r~| || <q�|| =q�Wq�W|j�x.|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. r)�TextFiler�surrogateescape)Zstrip_commentsZ skip_blanksZ join_lines�errorsNrz$$r�$r5r;r=TF�PY_�)r5r;r=)Zdistutils.text_filercrU� _variable_rxrVrW�strip�replacerXrY�list� _findvar1_rx�search� _findvar2_rx�strr rErF�end�start�close�items� isinstance�update)rr[rcrZ�done�notdoner^r_r`ra�tmpv�renamed_variablesr"�value�found�item�after�krrr�parse_makefiles�                       r�cCsZxTtj|�ptj|�}|rP|j�\}}|d|�|j|jd��||d�}qPqW|S)a�Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in 'string' according to 'vars' (a dictionary mapping variable names to values). Variables not present in 'vars' are silently expanded to the empty string. The variable values in 'vars' should not contain further variable expansions; if 'vars' is the output of 'parse_makefile()', you're fine. Returns a variable-expanded version of 's'. rrN)rmrnro�span�getrW)�s�varsr_Zbegrqrrr�expand_makefile_vars�s *r�c CsVtjjddjtjtjttjdd�d��}t |t �t �dgd�}|j }ia t j|�dS) z7Initialize the module as appropriate for POSIX systems.�_PYTHON_SYSCONFIGDATA_NAMEz+_sysconfigdata_{abi}_{platform}_{multiarch}rNr)�abir@� multiarch�build_time_varsrN)r rEr�rOr�abiflagsr@�getattrrQ� __import__�globals�localsr�rCrv)r"�_tempr�rrr� _init_posix�sr�cCs~i}tddd�|d<tddd�|d<tdd�|d<tj�d|d<d |d <t�jd d �|d <tjjtjj t j ��|d<|a dS)z+Initialize the module as appropriate for NTrr)r'r.�LIBDEST� BINLIBDEST)r'� INCLUDEPY� EXT_SUFFIXz.exe�EXE�.r�VERSION�BINDIRN) r/r)�_imp�extension_suffixesrrkr r �dirname�abspathr� executablerC)r[rrr�_init_nt�sr�cGs^tdk�r(t�jdtj�}|r(|�niattd<ttd<tjd�}|dk rV|td<tjdt�}tjdkr�tr�tj j t ��}tj j ||�}ntj j t ��}tj j tj j|��td<to�tjdk�r t}tj jtd� o�|tj�k�r tj j |td�}tj j|�td<tjd k�r(d dl}|jt�|�rVg}x|D]}|jtj|���q8W|StSdS) a�With no arguments, return a dictionary of all configuration variables relevant for the current platform. Generally this includes everything needed to build extensions and install both pure modules and extensions. 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. NZ_init_r(� exec_prefixr��SOrrr0r)rCr�r�r r"r-r,rr#r r�rRr r�r%�isabs�getcwdrr@rA�customize_config_vars�append)�args�funcr�r�baserA�valsr"rrrrD�s@       rDcCs*|dkrddl}|jdtd�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) r�rNz SO is deprecated, use EXT_SUFFIXr)�warnings�warn�DeprecationWarningrDr�)r"r�rrrr$sr$)rr)rr)rN)rrN)N)N)3�__doc__r�r rSrrerr r%r(r-r�r,� base_prefixr!�base_exec_prefixr rEr�rr�r�r"�lower�endswithrr�rrr#r&r��AttributeErrorrr)r/rBrLrRrbrTrirmror�r�rCr�r�rDr$rrrr� sZ      # +I      jJ