��Qc@s�dZdZddlZddlZddlZddlmZmZddlm Z ddl
mZddlm
Z
mZmZddlmZd �Zd
e fd��YZdefd
��YZdZdZdZd�Zd�ZdS(sdistutils.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).
s$Id$i�N(tgen_preprocess_optionstgen_lib_options(t
UnixCCompiler(t
write_file(tDistutilsExecErrortCompileErrortUnknownFileError(tlogcCs�tjjd�}|dkr�tj|d|d!}|dkrIdgS|dkr\dgS|d krod
gS|dkr�dgStd
|��ndS(saInclude the appropriate MSVC runtime library if Python was built
with MSVC 7.0 or later.
sMSC v.i�ii
t1300tmsvcr70t1310tmsvcr71t1400tmsvcr80t1500tmsvcr90sUnknown MS Compiler version %s N(tsystversiontfindt
ValueError(tmsc_postmsc_ver((s//sys/lib/python2.7/distutils/cygwinccompiler.pyt get_msvcr;stCygwinCCompilercBs�eZdZdZdZdZdZdZdZdddd�Z d �Z
d
d
d
d
d
dd
d
d
d
d
�Zddd�Z
RS(tcygwins.os.as.dllslib%s%ss%s%ss.exeic
CsStj||||�t�\}}|jd||f�|tk r\|jd|�nt�\|_|_|_ |j|j
d|j|j|j f�|jdkr�d|_n d|_|jdkr�d}nd }|jd
ddd
dddddd|j|f�|jdkrCdg|_
|jd�nt�|_
dS(Ns%Python's GCC status: %s (details: %s)s�Python's pyconfig.h doesn't seem to support your compiler. Reason: %s. Compiling may fail because of undefined preprocessor macros.s: gcc %s, ld %s, dllwrap %s
s2.10.90tgcctdllwraps2.13s-shareds
-mdll -statictcompilersgcc -mcygwin -O -Walltcompiler_sosgcc -mcygwin -mdll -O -Walltcompiler_cxxsg++ -mcygwin -O -Wallt
linker_exesgcc -mcygwint linker_sos%s -mcygwin %ss2.91.57tmsvcrts,Consider upgrading to a newer version of gcc(Rt__init__tcheck_config_htdebug_printtCONFIG_H_OKtwarntget_versionstgcc_versiont
ld_versiontdllwrap_versiont
compiler_typet
linker_dlltset_executablest
dll_librariesR(tselftverbosetdry_runtforcetstatustdetailst
shared_option((s//sys/lib/python2.7/distutils/cygwinccompiler.pyR!\s<
cCs�|dks|dkrZy |jdd|d|g�Wq�tk
rV}t|�q�XnHy)|j|j||d|g|�Wntk
r�}t|�nXdS(Ns.rcs.restwindress-is-o(tspawnRRR(R.tobjtsrctexttcc_argstextra_postargstpp_optstmsg((s//sys/lib/python2.7/distutils/cygwinccompiler.pyt_compile�s cCs�tj|
pg�}
tj|p$g�}tj|p9g�}|j|j�|dk r�||jksy|jdkr�tjj|d�}tjj tjj
|��\}}tjj||d�}tjj|d|d�}dtjj
|�dg}x|D]}|j|�qW|j
t||fd|�|jd krx|
jd
|g�|
jd|g�q�|j|�n| s�|
jd�ntj||||||||d| |
|||
�dS(
NRis.deftlibs.as
LIBRARY %stEXPORTSs
writing %sRs--output-libs--defs-s(tcopytextendR-tNonet
EXECUTABLER+tostpathtdirnametsplitexttbasenametjointappendtexecuteRRtlink(R.ttarget_desctobjectstoutput_filenamet
output_dirt librariestlibrary_dirstruntime_library_dirstexport_symbolstdebugt
extra_preargsR;t
build_tempttarget_langttemp_dirtdll_namet
dll_extensiontdef_filetlib_filetcontentstsym((s//sys/lib/python2.7/distutils/cygwinccompiler.pyRM�sJ
tcCs|dkrd}ng}x�D]�}tjjtjj|��\}}||jddgkr{td||f�n|r�tjj|�}n|dks�|dkr�|jtjj ||||j
��q"|jtjj |||j
��q"W|S(NRas.rcs.ress"unknown file type '%s' (from '%s')(RCRERFRHtnormcasetsrc_extensionsRRIRKRJt
obj_extension(R.tsource_filenamest strip_dirRQt obj_namestsrc_nametbaseR9((s//sys/lib/python2.7/distutils/cygwinccompiler.pytobject_filenamess"
$N(t__name__t
__module__R*Rdtstatic_lib_extensiontshared_lib_extensiontstatic_lib_formattshared_lib_formatt
exe_extensionR!R>RCRMRj(((s//sys/lib/python2.7/distutils/cygwinccompiler.pyRRs*> XtMingw32CCompilercBs eZdZdddd�ZRS(tmingw32icCs�tj||||�|jdkr.d}nd}|jdkrLd}nd}|jddd d
ddd
ddd|j||f�g|_t�|_dS(Ns2.13s-shareds
-mdll -statics2.91.57s--entry _DllMain@12RaRsgcc -mno-cygwin -O -WallRsgcc -mno-cygwin -mdll -O -WallRsg++ -mno-cygwin -O -WallRsgcc -mno-cygwinRs%s -mno-cygwin %s %s(RR!R(R'R,R+R-R(R.R/R0R1R4tentry_point((s//sys/lib/python2.7/distutils/cygwinccompiler.pyR!-s (RkRlR*R!(((s//sys/lib/python2.7/distutils/cygwinccompiler.pyRr)stoksnot okt uncertaincCs�ddlm}ddl}|jtjd�dkrAtdfS|j�}y.t|�}z|j �}Wd|j
�XWn'tk
r�}td||j
ffSX|j|d�dkr�td |fStd
|fSdS(s�Check if the current Python installation (specifically, pyconfig.h)
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__".
i�(t sysconfigNtGCCissys.version mentions 'GCC'scouldn't read '%s': %st__GNUC__s'%s' mentions '__GNUC__'s '%s' does not mention '__GNUC__'(t distutilsRwtstringRRRR$tget_config_h_filenametopentreadtclosetIOErrortCONFIG_H_UNCERTAINtstrerrortCONFIG_H_NOTOK(RwR{tfntftstexc((s//sys/lib/python2.7/distutils/cygwinccompiler.pyR"`s
cCs�ddlm}ddlm}ddl}|d�}|r�tj|dd�}|j�}|j�|j d|�}|r�||j
d ��}q�d}nd}|d
�}|r tj|dd�}|j�}|j�|j d|�}|r||j
d ��} q&d} nd} |d�}
|
r�tj|
d
d�}|j�}|j�|j d|�}|r�||j
d ��}q�d}nd}|| |fS(sj Try to find out the versions of gcc, ld and dllwrap.
If not possible it returns None for it.
i�(tLooseVersion(tfind_executableNRs
-dumpversiontrs(\d+\.\d+(\.\d+)*)itlds -vRs
--versions (\d+\.\d+(\.\d+)*)(tdistutils.versionR�tdistutils.spawnR�treREtpopenR~RtsearchtgroupRC(R�R�R�tgcc_exetoutt
out_stringtresultR'tld_exeR(tdllwrap_exeR)((s//sys/lib/python2.7/distutils/cygwinccompiler.pyR&�sD
(t__doc__t__revision__RERRAtdistutils.ccompilerRRtdistutils.unixccompilerRtdistutils.file_utilRtdistutils.errorsRRRRzRRRRrR$R�R�R"R&(((s//sys/lib/python2.7/distutils/cygwinccompiler.pyt<module>s+$ �3 5
|