Your IP : 18.118.93.61


Current Path : /opt/alt/python35/lib64/python3.5/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/distutils/__pycache__/cygwinccompiler.cpython-35.pyc



��YfZ@�@sgdZddlZddlZddlZddlmZmZmZddlZddl	m
Z
mZddlm
Z
ddlmZddlmZmZmZmZddlmZdd	lmZdd
lmZdd�ZGd
d�de
�ZGdd�de�ZdZdZdZ dd�Z!ej"d�Z#dd�Z$dd�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)�gen_preprocess_options�gen_lib_options)�
UnixCCompiler)�
write_file)�DistutilsExecError�CCompilerError�CompileError�UnknownFileError)�log)�LooseVersion)�find_executablecCs�tjjd�}|dkr�tj|d|d�}|dkrLdgS|dkr_dgS|d	krrd
gS|dkr�dgS|d
kr�dgStd|��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/python35/lib64/python3.5/distutils/cygwinccompiler.py�	get_msvcr?src@s�eZdZdZdZdZdZdZdZdZ	dZ
d	d	d	d
d�Zdd
�Zdddddd	dddddd�
Z
d	ddd�ZdS)�CygwinCCompilerz? Handles the Cygwin port of the GNU C compiler to Windows.
    �cygwinz.oz.az.dllzlib%s%sz%s%sz.exerc
CsPtj||||�t�\}}|jd||f�|tk	rY|jd|�t�\|_|_|_	|j|j
d|j|j|j	f�|jdkr�d|_n	d|_|jdkr�d}nd	}|jd
ddd
dddddd|j|f�|jdkr@dg|_
|jd�nt�|_
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�dllwrapz2.13z-sharedz
-mdll -static�compilerzgcc -mcygwin -O -Wall�compiler_sozgcc -mcygwin -mdll -O -Wall�compiler_cxxzg++ -mcygwin -O -Wall�
linker_exezgcc -mcygwin�	linker_soz%s -mcygwin %sz2.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$ds<			
zCygwinCCompiler.__init__cCs�|dks|dkroy |jdd|d|g�Wq�tk
rk}zt|��WYdd}~Xq�Xn]y)|j|j||d|g|�Wn1tk
r�}zt|��WYdd}~XnXdS)z:Compiles the source by spawning GCC and windres if needed.z.rcz.resZwindresz-iz-oN)Zspawnr	rr )r/�obj�src�extZcc_args�extra_postargsZpp_opts�msgrrr�_compile�s "zCygwinCCompiler._compileNcCs�tj|
pg�}
tj|p$g�}tj|p9g�}|j|j�|dk	r�||jksy|jdkr�tjj|d�}tjjtjj	|��\}}tjj
||d�}tjj
|d|d�}dtjj	|�dg}x|D]}|j|�qW|jt
||fd	|�|jd
krx|
jd|g�|
jd|g�n
|j|�|	s�|
jd
�tj||||||||d|	|
|||
�dS)zLink the objects.Nrrz.def�libz.az
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�s:			


	zCygwinCCompiler.link�cCs�|dkrd}g}x�|D]�}tjjtjj|��\}}||jddgkrxtd||f��|r�tjj|�}|dkr�|jtjj||||j	��q|jtjj|||j	��qW|S)z#Adds supports for rc and res files.NrH�.rc�.resz"unknown file type '%s' (from '%s'))rJrI)
r=r>r@�normcaseZsrc_extensionsrrArCrB�
obj_extension)r/Zsource_filenamesZ	strip_dirrEZ	obj_namesZsrc_name�baser6rrr�object_filenames�s 
$z CygwinCCompiler.object_filenames)�__name__�
__module__�__qualname__�__doc__r+rLZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ
exe_extensionr$r9rDrNrrrrrYs;		Krc@s1eZdZdZdZddddd�ZdS)�Mingw32CCompilerz@ Handles the Mingw32 port of the GNU C compiler to Windows.
    Zmingw32rcCs�tj||||�|jdkr.d}nd}|jdkrLd}nd}t�rgtd��|jdd	d
ddd
dddd|j||f�g|_t	�|_dS)Nz2.13z-sharedz
-mdll -staticz2.91.57z--entry _DllMain@12rHz1Cygwin gcc cannot be used with --compiler=mingw32rzgcc -O -Wallr zgcc -mdll -O -Wallr!zg++ -O -Wallr"rr#z%s %s %s)
rr$r*r)�is_cygwingccr
r-r,r.r)r/r0r1r2r3Zentry_pointrrrr$s&						zMingw32CCompiler.__init__N)rOrPrQrRr+r$rrrrrSsrS�okznot okZ	uncertaincCs�ddlm}dtjkr)tdfS|j�}yPt|�}z2d|j�krgtd|fStd|fSWd|j	�XWn<t
k
r�}ztd	||jffSWYdd}~XnXdS)
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__'Nzcouldn't read '%s': %s)
�	distutilsrVrrr&�get_config_h_filename�open�read�CONFIG_H_NOTOK�close�OSError�CONFIG_H_UNCERTAIN�strerror)rV�fn�config_h�excrrrr%Hs
r%s(\d+\.\d+(\.\d+)*)cCs�|j�d}t|�dkr&dSt|dddt�j}z|j�}Wd|j�Xtj|�}|dkr~dSt	|j
d�j��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.
    rN�shellT�stdoutr)�splitrrrrdrZr\�
RE_VERSION�searchr�group�decode)�cmd�
executable�out�
out_string�resultrrr�_find_exe_versionusrocCs&dddg}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)ro)�.0rjrrr�
<listcomp>�s	z get_versions.<locals>.<listcomp>)�tuple)Zcommandsrrrr(�sr(cCs%tddg�}|j�jd�S)z>Try to determine if the gcc that would be used is from cygwin.rz-dumpmachinescygwin)r�strip�endswith)rmrrrrT�srT)'rRr=rr;�
subprocessrrr�reZdistutils.ccompilerrrZdistutils.unixccompilerrZdistutils.file_utilrZdistutils.errorsr	r
rrrWr
Zdistutils.versionrZdistutils.spawnrrrrSr&r[r^r%�compilerfror(rTrrrr�<module>s.)"�1+

?>