B � f�P�@s�dZddlZddlZddlZddlZddlmZej�ej �Z ej�ej �Z ej�ej �Zej�ej�Zdejkr�ej�ejd�Zn&ejr�ej�ej�ej��Zne��Zdd�Zeedd�Zejd kr�d d �Zee�Zee�Zd d �Ze�ZdZye�sejZWne k �rYnXdd�Z!d,dd�Z"d-dd�Z#dd�Z$dd�Z%dd�Z&d.dd�Z'e�(d�Z)e�(d�Z*e�(d�Z+d/d d!�Z,d"d#�Z-da.d$d%�Z/d&d'�Z0d(d)�Z1d*d+�Z2dS)0a�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_BASEcCs.x(dD] }tj�tj�|d|��rdSqWdS)N)z Setup.distz Setup.localZModulesTF)�os�path�isfile�join)�d�fn�r �8/opt/alt/python37/lib64/python3.7/distutils/sysconfig.py�_is_python_source_dir,s r �_home�ntcCs0|r,tj�|��tj�tj�td���r,tS|S)NZPCbuild)rr�normcase� startswithr�PREFIX)rr r r � _fix_pcbuild5srcCstr tt�Stt�S)N)� _sys_homer � project_baser r r r � _python_build=sr�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_infor r r r �get_python_versionQsrcCs�|dkr|rtpt}tjdkrjtrL|r.tp,tStj�t d�d�}tj� |�Sdt �t }tj�|d|�Stjdkr�tr�tj�|d�tjj tj�|d�Stj�|d�Std tj��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�pythonZincluder�PCzFI don't know where Python installs its C header files on platform '%s')�BASE_EXEC_PREFIX� BASE_PREFIXr�name� python_buildrrrr�get_config_var�normpathr� build_flags�pathsepr)� plat_specific�prefixZincdirZ python_dirr r r �get_python_incYs$     r)cCs�|dkr&|r|rtpt}n |r"tp$t}tjdkrp|s8|r>d}nd}tj�||dt��}|r`|Stj�|d�SncCs\trtj�tptd�Stddd�}d�t�t �}t t j d�rL|dt j j 7}tj�||d�S)zAReturn full pathname of installed Makefile from the Python build.ZMakefilerr)r'r-z config-{}{}� _multiarchz-%s)r"rrrrrr.�formatrr%�hasattrr�implementationr?)Zlib_dirZ config_filer r r �get_makefile_filenames  rCcCs�|dkr i}t�d�}t�d�}xx|��}|s0P|�|�}|rz|�dd�\}}y t|�}Wntk rnYnX|||<q"|�|�}|r"d||�d�<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�gZ define_rxZundef_rx�line�m�n�vr r r �parse_config_h s(      rQz"([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�|��}|dkrFPt�|�}|r4|�dd�\}} | ��} | �dd �} d | kr�| ||<q4y t| �} Wn$t k r�| �dd �||<Yq4X| ||<q4Wd } �x�|�r��x�t |�D�]�} || } t � | ��pt � | �}|�r�|�d�}d }||k�r2t||�}n�||k�rBd }nx|tjk�rZtj|}n`|| k�r�| �d��r�| dd�| k�r�d }n$d||k�r�d }nt|d|�}n d ||<}|�r�| |��d�}| d|���} |��| k�r�| |7} | |7} d |k�r| || <nzy t| �} Wn"t k �r@| ��|| <Yn X| || <|| =| �d��r�| dd�| k�r�| dd�} | |k�r�| || <q�|| =q�Wq�W|��x.|��D]"\}} t| t��r�| ��||<�q�W|�|�|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�$)r1r2r4TFZPY_�)Zdistutils.text_filerRrF� _variable_rxrGrH�strip�replacerIrJ�list� _findvar1_rx�search� _findvar2_rx�strrr<r�end�start�close�items� isinstance�update)r rLrRrKZdoneZnotdonerMrNrOrPZtmpvZrenamed_variablesr!�value�found�itemZafter�kr r r �parse_makefile0s�                       ricCsZxTt�|�pt�|�}|rP|��\}}|d|�|�|�d��||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)r[r\r]�span�getrH)�s�varsrNZbegr_r r r �expand_makefile_vars�s *rnc CsVtj�ddjtjtjttjdd�d��}t |t �t �dgd�}|j }ia t �|�dS) z7Initialize the module as appropriate for POSIX systems.Z_PYTHON_SYSCONFIGDATA_NAMEz+_sysconfigdata_{abi}_{platform}_{multiarch}r?r)Zabir7Z multiarch�build_time_varsrN)rr<rkr@r�abiflagsr7�getattrrB� __import__�globals�localsror:rd)r!Z_tempror r r � _init_posix�srucCs~i}tddd�|d<tddd�|d<tdd�|d<t��d|d<d |d <t��d d �|d <tj�tj� t j ��|d<|a dS)z+Initialize the module as appropriate for NTrr)r'r-ZLIBDESTZ BINLIBDEST)r'Z INCLUDEPY� EXT_SUFFIXz.exeZEXE�.rZVERSIONZBINDIRN) r.r)�_imp�extension_suffixesrrYrr�dirname�abspathr� executabler:)rLr r r �_init_nt�sr}cGs`tdk�r*t��dtj�}|r(|�niattd<ttd<t�d�}|dk rV|td<t�dt�}tjdkr�tr�tj � t ��}tj � ||�}ntj � t ��}tj � tj �|��td<t�r tjdk�r t}tj �td��s |t��k�r tj � |td�}tj �|�td<tjd k�r*d dl}|�t�|�rXg}x|D]}|�t�|���q:W|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_prefixrv�SOrrr/r)r:rsrkrr!rr,rr"rrzrCrr{r$�isabs�getcwdrr7r8Zcustomize_config_vars�append)�args�funcrr�baser8Zvalsr!r r r r;�s@       r;cCs*|dkrddl}|�dtd�t��|�S)z�Return the value of a single variable using the dictionary returned by 'get_config_vars()'. Equivalent to get_config_vars().get(name) rrNz SO is deprecated, use EXT_SUFFIXr)�warnings�warn�DeprecationWarningr;rk)r!r�r r r r#%sr#)rN)rrN)N)N)3�__doc__rxrrDrrTrrr$r(rr~r,� base_prefixr �base_exec_prefixrr<r{rr|rzr�r rqrr!rrr"r%rp�AttributeErrorrr)r.r9r>rCrQrErWr[r]rirnr:rur}r;r#r r r r � sZ      ( +I      mJ