Your IP : 52.14.75.147
U
i�f^@ � @ s� d dl Z d dlZd dlZd dlmZmZmZ d dlZd dlm Z m
Z
d dlmZ d dl
mZ d dlmZmZmZmZ d dlmZ d dlmZ d d lmZ d
d� ZG dd
� d
e�ZG dd� de�ZdZdZdZdd� Z e�!d�Z"dd� Z#dd� Z$dd� Z%dS )� N)�Popen�PIPE�check_output)�gen_preprocess_options�gen_lib_options)�
UnixCCompiler)�
write_file)�DistutilsExecError�CCompilerError�CompileError�UnknownFileError)�log)�LooseVersion)�find_executablec C s� t j�d�} | dkr|t j| d | d � }|dkr8dgS |dkrFdgS |d krTd
gS |dkrbdgS |d
krpdgS td| ��d S )NzMSC v.���� �
Z1300Zmsvcr70Z1310Zmsvcr71Z1400Zmsvcr80Z1500Zmsvcr90Z1600Zmsvcr100zUnknown MS Compiler version %s )�sys�version�find�
ValueError)Zmsc_posZmsc_ver� r �>/opt/alt/python38/lib64/python3.8/distutils/cygwinccompiler.py� get_msvcr? s r c
@ sN e Zd ZdZdZdZdZdZdZdZ dd d
�Z
dd� Zddd�Zddd�Z
d
S )�CygwinCCompiler�cygwinz.o�.az.dllzlib%s%sz%s%sz.exer c C s� t �| |||� t� \}}| �d||f � |tk rB| �d| � t� \| _| _| _ | �| j
d| j| j| j f � | jdkr�d| _nd| _| jdkr�d}nd }| jd
ddd
d| j|f d� | jdkr�dg| _
| �d� nt� | _
d S )Nz%Python's GCC status: %s (details: %s)z�Python's pyconfig.h doesn't seem to support your compiler. Reason: %s. Compiling may fail because of undefined preprocessor macros.z: gcc %s, ld %s, dllwrap %s
z2.10.90�gcc�dllwrap�2.13�-shared�
-mdll -staticzgcc -mcygwin -O -Wallzgcc -mcygwin -mdll -O -Wallzg++ -mcygwin -O -Wallzgcc -mcygwinz%s -mcygwin %s�Zcompiler�compiler_soZcompiler_cxxZ
linker_exeZ linker_so�2.91.57Zmsvcrtz,Consider upgrading to a newer version of gcc)r �__init__�check_config_hZdebug_print�CONFIG_H_OK�warn�get_versions�gcc_version�
ld_versionZdllwrap_version�
compiler_type�
linker_dll�set_executables�
dll_librariesr )�self�verbose�dry_run�forceZstatusZdetails�
shared_optionr r r r% d sN
����
��
��
�zCygwinCCompiler.__init__c
C s� |dks|dkrVz| � dd|d|g� W q� tk
rR } zt|��W 5 d }~X Y q�X nNz"| � | j| |d|g | � W n* tk
r� } zt|��W 5 d }~X Y nX d S )N�.rc�.resZwindresz-iz-o)Zspawnr r r# )r0 �obj�src�extZcc_args�extra_postargsZpp_opts�msgr r r �_compile� s �
zCygwinCCompiler._compileNc C sP t � |
p
g �}
t � |pg �}t � |p&g �}|�| j� |d k �r|| jksV| jdk�rtj�|d �}tj�tj� |��\}}tj�
||d �}tj�
|d| d �}dtj� |� dg}|D ]}|�|� q�| �t
||fd| � | jd k�r|
�d
|g� |
�d|g� n
|�|� | �s(|
�d� t�| |||||||d | |
|||
� d S )
Nr r z.def�libr z
LIBRARY %sZEXPORTSz
writing %sr z--output-libz--defz-s)�copy�extendr/ Z
EXECUTABLEr- �os�path�dirname�splitext�basename�join�appendZexecuter r �link)r0 Ztarget_descZobjectsZoutput_filename�
output_dirZ librariesZlibrary_dirsZruntime_library_dirsZexport_symbols�debugZ
extra_preargsr: Z
build_tempZtarget_langZtemp_dirZdll_nameZ
dll_extensionZdef_fileZlib_file�contentsZsymr r r rG � sR
��
���
�zCygwinCCompiler.link� c C s� |d krd}g }|D ]�}t j�t j�|��\}}|| jddg krRtd||f ��|rbt j�|�}|dkr�|�t j�||| | j �� q|�t j�||| j �� q|S )NrK r5 r6 z"unknown file type '%s' (from '%s'))r6 r5 )
r@ rA rC �normcaseZsrc_extensionsr rD rF rE �
obj_extension)r0 Zsource_filenamesZ strip_dirrH Z obj_namesZsrc_name�baser9 r r r �object_filenames� s&