Edit File: cygwinccompiler.cpython-36.pyc
3 � \[@������������������@���s����d�Z�ddlZddlZddlZddlmZmZmZ�ddlZddl m Z mZ�ddlm Z �ddlmZ�ddlmZmZmZmZ�ddlmZ�dd lmZ�dd lmZ�dd��ZG�d d��de �ZG�dd��de�ZdZdZdZ dd��Z!ej"d�Z#dd��Z$dd��Z%dd��Z&dS�)a��distutils.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_executablec��������������C���s����t�jjd�}�|�dkr|t�j|�d�|�d���}|dkr8dgS�|dkrFdgS�|d krTd gS�|dkrbdgS�|d krpdgS�td|���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����1/usr/lib64/python3.6/distutils/cygwinccompiler.py� get_msvcr?���s����r���c������������ ���@���sR���e�Zd�ZdZdZdZdZdZdZdZ dZ dd d�Zdd ��Zddd�Z ddd�ZdS�)�CygwinCCompilerz? Handles the Cygwin port of the GNU C compiler to Windows. �cygwinz.oz.az.dllzlib%s%sz%s%sz.exer���c�������������C���s����t�j|�|||��t��\}}|�jd||f���|tk rB|�jd|���t��\|�_|�_|�_ |�j|�j d|�j|�j|�j f����|�jdkr�d|�_nd|�_|�jdkr�d}nd }|�jd ddd d|�j|f�d��|�jdkr�dg|�_ |�jd��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�dllwrapz2.13z-sharedz -mdll -staticzgcc -mcygwin -O -Wallzgcc -mcygwin -mdll -O -Wallzg++ -mcygwin -O -Wallzgcc -mcygwinz%s -mcygwin %s)�compiler�compiler_so�compiler_cxx� linker_exe� linker_soz2.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���s<���� zCygwinCCompiler.__init__c�������������C���s����|dks|dkrVy|�j�dd|d|g��W�q��tk rR�}�zt|��W�Y�dd}~X�q�X�nNy"|�j�|�j|�|d|g�|���W�n*�tk r��}�zt|��W�Y�dd}~X�nX�dS�)z:Compiles the source by spawning GCC and windres if needed.z.rcz.resZwindresz-iz-oN)Zspawnr ���r���r ���)r/����obj�src�extZcc_args�extra_postargsZpp_opts�msgr���r���r����_compile����s����zCygwinCCompiler._compileNc�������������C���sR��t�j�| p g��} t�j�|pg��}t�j�|p&g��}|j|�j��|dk oP||�jksT|�jdk�rtjj|d��}tjjtjj |��\}}tjj ||d��}tjj |d|�d��}dtjj |��dg}x|D�]}|j|��q�W�|�jt ||fd |���|�jd k�r| jd|g��| jd|g��n |j|��| �s*| jd ��tj|�|||||||d| | ||| ��dS�)zLink the objects.Nr���r���z.def�libz.az LIBRARY %sZEXPORTSz writing %sr���z--output-libz--defz-s)�copy�extendr.���Z EXECUTABLEr,����os�path�dirname�splitext�basename�join�appendZexecuter���r����link)r/���Ztarget_descZobjectsZoutput_filename� output_dirZ librariesZlibrary_dirsZruntime_library_dirsZexport_symbols�debugZ extra_preargsr7���Z build_tempZtarget_langZtemp_dirZdll_nameZ dll_extensionZdef_fileZlib_file�contentsZsymr���r���r���rD�������s:���� zCygwinCCompiler.link��c�������������C���s����|dkrd}g�}x�|D�]�}t�jjt�jj|��\}}||�jddg�krTtd||f���|rdt�jj|�}|dkr�|jt�jj|||�|�j ����q|jt�jj|||�j ����qW�|S�)z#Adds supports for rc and res files.NrH����.rc�.resz"unknown file type '%s' (from '%s'))rJ���rI���) r=���r>���r@����normcaseZsrc_extensionsr���rA���rC���rB���� obj_extension)r/���Zsource_filenamesZ strip_dirrE���Z obj_namesZsrc_name�baser6���r���r���r����object_filenames����s ���� z CygwinCCompiler.object_filenames)r���r���r���) NNNNNr���NNNN)r���rH���)�__name__� __module__�__qualname__�__doc__r+���rL���Zstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionr$���r9���rD���rN���r���r���r���r���r���Y���s��� ;��� Kr���c���������������@���s���e�Zd�ZdZdZddd�ZdS�)�Mingw32CCompilerz@ Handles the Mingw32 port of the GNU C compiler to Windows. Zmingw32r���c���������� ���C���sx���t�j|�|||��|�jdkr d}nd}|�jdkr4d}nd}t��rFtd��|�jdd d dd|�j||f�d ��g�|�_t ��|�_d�S�)Nz2.13z-sharedz -mdll -staticz2.91.57z--entry _DllMain@12rH���z1Cygwin gcc cannot be used with --compiler=mingw32zgcc -O -Wallzgcc -mdll -O -Wallzg++ -O -Wallr���z%s %s %s)r���r ���r!���r"���r#���) r���r$���r*���r)����is_cygwingccr ���r-���r,���r.���r���)r/���r0���r1���r2���r3���Zentry_pointr���r���r���r$�����s&���� zMingw32CCompiler.__init__N)r���r���r���)rO���rP���rQ���rR���r+���r$���r���r���r���r���rS�����s���rS����okznot okZ uncertainc��������������C���s����ddl�m}��dtjkrtdfS�|�j��}y@t|�}z(d|j��krJtd|�fS�td|�fS�W�d|j ���X�W�n.�t k r��}�ztd ||jf�fS�d}~X�nX�dS�) aw��Check 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) � distutilsrV���r���r���r&����get_config_h_filename�open�read�CONFIG_H_NOTOK�close�OSError�CONFIG_H_UNCERTAIN�strerror)rV����fn�config_h�excr���r���r���r%���H��s���� r%���s���(\d+\.\d+(\.\d+)*)c�������������C���sl���|�j���d�}t|�dkrdS�t|�dtd�j}z|j��}W�d|j���X�tj|�}|dkrZdS�t |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. r���NT)�shell�stdoutr���)�splitr���r���r���rd���rZ���r\���� RE_VERSION�searchr����group�decode)�cmd� executable�out� out_string�resultr���r���r����_find_exe_versionu��s���� ro���c��������������C���s���dddg}�t�dd��|�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 --versionc�������������S���s���g�|�]}t�|��qS�r���)ro���)�.0rj���r���r���r���� <listcomp>���s����z get_versions.<locals>.<listcomp>)�tuple)Zcommandsr���r���r���r(������s���� r(���c��������������C���s���t�ddg�}�|�j��jd�S�)z>Try to determine if the gcc that would be used is from cygwin.r���z-dumpmachines���cygwin)r����strip�endswith)rm���r���r���r���rT������s����rT���)'rR���r=���r���r;���� subprocessr���r���r����reZdistutils.ccompilerr���r���Zdistutils.unixccompilerr���Zdistutils.file_utilr���Zdistutils.errorsr ���r ���r���r���rW���r ���Zdistutils.versionr���Zdistutils.spawnr���r���r���rS���r&���r[���r^���r%����compilerf���ro���r(���rT���r���r���r���r����<module>���s0���)�;1+