Your IP : 3.135.249.76


Current Path : /opt/alt/python39/lib64/python3.9/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/distutils/__pycache__/cygwinccompiler.cpython-39.opt-1.pyc

a

R�f�?�@s�dZddlZddlZddlZddlmZmZmZddlZddl	m
Z
ddlmZddl
mZmZmZmZddlmZddlmZd	d
�ZGdd�de
�ZGd
d�de�ZdZdZdZdd�Ze�d�Zdd�Zdd�Z dd�Z!dS)adistutils.cygwinccompiler

Provides the CygwinCCompiler class, a subclass of UnixCCompiler that
handles the Cygwin port of the GNU C compiler to Windows.  It also contains
the Mingw32CCompiler class which handles the mingw32 port of GCC (same as
cygwin in no-cygwin mode).
�N)�Popen�PIPE�check_output)�
UnixCCompiler)�
write_file)�DistutilsExecError�CCompilerError�CompileError�UnknownFileError)�LooseVersion)�find_executablecCs�tj�d�}|dkr|tj|d|d�}|dkr8dgS|dkrFdgS|d	krTd
gS|dkrbdgS|d
krpdgStd|��dS)zaInclude the appropriate MSVC runtime library if Python was built
    with MSVC 7.0 or later.
    zMSC v.�����
Z1300Zmsvcr70Z1310Zmsvcr71Z1400Zmsvcr80Z1500Zmsvcr90Z1600Zmsvcr100zUnknown MS Compiler version %s N)�sys�version�find�
ValueError)Zmsc_posZmsc_ver�r�>/opt/alt/python39/lib64/python3.9/distutils/cygwinccompiler.py�	get_msvcr=src
@sReZdZdZdZdZdZdZdZdZ	dZ
dd
d�Zdd
�Zddd�Z
ddd�ZdS)�CygwinCCompilerz? Handles the Cygwin port of the GNU C compiler to Windows.
    �cygwinz.o�.az.dllzlib%s%sz%s%sz.exercCs�t�||||�t�\}}|�d||f�|turB|�d|�t�\|_|_|_	|�|j
d|j|j|j	f�|jdkr�d|_nd|_|jdkr�d}nd	}|jd
ddd
d|j|fd�|jdkr�dg|_
|�d�nt�|_
dS)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 -Wallzgcc -mcygwinz%s -mcygwin %s�Zcompiler�compiler_soZcompiler_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_optionrrrr"bsN
����
��


��
�zCygwinCCompiler.__init__c
Cs�|dks|dkrXz|�dd|d|g�Wq�tyT}zt|��WYd}~q�d}~00nPz"|�|j||d|g|�Wn,ty�}zt|��WYd}~n
d}~00dS)z:Compiles the source by spawning GCC and windres if needed.�.rc�.resZwindresz-iz-oN)Zspawnrr	r )r-�obj�src�extZcc_args�extra_postargsZpp_opts�msgrrr�_compile�s �
zCygwinCCompiler._compileNcCsPt�|
p
g�}
t�|pg�}t�|p&g�}|�|j�|du�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|	|
|||
�dS)zLink the objects.Nrrz.def�librz
LIBRARY %sZEXPORTSz
writing %srz--output-libz--defz-s)�copy�extendr,Z
EXECUTABLEr*�os�path�dirname�splitext�basename�join�appendZexecuterr�link)r-Ztarget_descZobjectsZoutput_filename�
output_dirZ	librariesZlibrary_dirsZruntime_library_dirsZexport_symbols�debugZ
extra_preargsr7Z
build_tempZtarget_langZtemp_dirZdll_nameZ
dll_extensionZdef_fileZlib_file�contentsZsymrrrrD�sH
��

���

�zCygwinCCompiler.link�cCs�|durd}g}|D]�}tj�tj�|��\}}||jddgvrRtd||f��|rbtj�|�}|dvr�|�tj�||||j	��q|�tj�|||j	��q|S)z#Adds supports for rc and res files.NrHr2r3z"unknown file type '%s' (from '%s'))r3r2)
r=r>r@�normcaseZsrc_extensionsr
rArCrB�
obj_extension)r-Zsource_filenamesZ	strip_dirrEZ	obj_namesZsrc_name�baser6rrr�object_filenames�s&���z CygwinCCompiler.object_filenames)rrr)
NNNNNrNNNN)rrH)�__name__�
__module__�__qualname__�__doc__r)rJZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionr"r9rDrLrrrrrWs 
;�
Nrc@seZdZdZdZddd�ZdS)�Mingw32CCompilerz@ Handles the Mingw32 port of the GNU C compiler to Windows.
    Zmingw32rc	Csxt�||||�|jdkr d}nd}|jdkr4d}nd}t�rFtd��|jdd	d
dd|j||fd
�g|_t	�|_dS)Nrrrr!z--entry _DllMain@12rHz1Cygwin gcc cannot be used with --compiler=mingw32zgcc -O -Wallzgcc -mdll -O -Wallzg++ -O -Wallrz%s %s %sr)
rr"r(r'�is_cygwingccrr+r*r,r)r-r.r/r0r1Zentry_pointrrrr"s.

����zMingw32CCompiler.__init__N)rrr)rMrNrOrPr)r"rrrrrQsrQ�okznot okZ	uncertainc
Cs�ddlm}dtjvrtdfS|��}z`t|�}zHd|��vrVtd|fW|��WSt	d|fW|��WSW|��n
|��0Wn6t
y�}ztd||jffWYd	}~Sd	}~00d	S)
awCheck if the current Python installation appears amenable to building
    extensions with GCC.

    Returns a tuple (status, details), where 'status' is one of the following
    constants:

    - CONFIG_H_OK: all is well, go ahead and compile
    - CONFIG_H_NOTOK: doesn't look good
    - CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h

    'details' is a human-readable string explaining the situation.

    Note there are two ways to conclude "OK": either 'sys.version' contains
    the string "GCC" (implying that this Python was built with GCC), or the
    installed "pyconfig.h" contains the string "__GNUC__".
    r)�	sysconfigZGCCzsys.version mentions 'GCC'Z__GNUC__z'%s' mentions '__GNUC__'z '%s' does not mention '__GNUC__'zcouldn't read '%s': %sN)
Z	distutilsrTrrr$Zget_config_h_filename�open�read�close�CONFIG_H_NOTOK�OSError�CONFIG_H_UNCERTAIN�strerror)rT�fnZconfig_h�excrrrr#Fs&
���r#s(\d+\.\d+(\.\d+)*)cCst|��d}t|�durdSt|dtd�j}z|��}W|��n
|��0t�|�}|durbdSt	|�
d����S)z�Find the version of an executable by running `cmd` in the shell.

    If the command is not found, or the output does not match
    `RE_VERSION`, returns None.
    rNT)�shell�stdout�)�splitrrrr_rVrW�
RE_VERSION�searchr�group�decode)�cmd�
executable�out�
out_string�resultrrr�_find_exe_versionss

rkcCsgd�}tdd�|D��S)zg Try to find out the versions of gcc, ld and dllwrap.

    If not possible it returns None for it.
    )zgcc -dumpversionzld -vzdllwrap --versioncSsg|]}t|��qSr)rk)�.0rfrrr�
<listcomp>��z get_versions.<locals>.<listcomp>)�tuple)Zcommandsrrrr&�sr&cCstddg�}|���d�S)z>Try to determine if the gcc that would be used is from cygwin.rz-dumpmachinescygwin)r�strip�endswith)rirrrrR�srR)"rPr=rr;�
subprocessrrr�reZdistutils.unixccompilerrZdistutils.file_utilrZdistutils.errorsrrr	r
Zdistutils.versionrZdistutils.spawnrrrrQr$rXrZr#�compilerbrkr&rRrrrr�<module>s,/;1+


?>