ž «ÿf].c@sÐdZddlZddlZddlZddlmZmZddlmZddl m Z ddl m Z m Z mZddlmZGdd „d eƒZd Zd Zd Zd d„Zdd„ZdS(uŽdistutils.emxccompiler Provides the EMXCCompiler class, a subclass of UnixCCompiler that handles the EMX port of the GNU C compiler to OS/2. iN(ugen_preprocess_optionsugen_lib_options(u UnixCCompiler(u write_file(uDistutilsExecErroru CompileErroruUnknownFileError(ulogc Bs°|EeZdZdZdZdZdZdZdZdZ dZ dddd d „Z d d „Z ddddddddddd d„ Zdddd„Zddd„ZdS(u EMXCCompileruemxu.obju.libu.dllu%s%su.resu.exeic CsÏtj||||ƒtƒ\}}|jd||fƒ|tk rd|jdd|dƒntƒ\|_|_|j|j d|j|jfƒ|j ddddd d d d ƒd g|_ dS(Nu%Python's GCC status: %s (details: %s)u<Python's pyconfig.h doesn't seem to support your compiler. u Reason: %s.u<Compiling may fail because of undefined preprocessor macros.u: gcc %s, ld %s ucompileru5gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wallu compiler_sou linker_exeugcc -Zomf -Zmt -Zcrtdllu linker_sougcc -Zomf -Zmt -Zcrtdll -Zdllugcc( u UnixCCompileru__init__ucheck_config_hu debug_printu CONFIG_H_OKuwarnu get_versionsu gcc_versionu ld_versionu compiler_typeuset_executablesu dll_libraries(uselfuverboseudry_runuforceustatusudetails((u;/opt/alt/python33/lib64/python3.3/distutils/emxccompiler.pyu__init__(s"    uEMXCCompiler.__init__cCs¾|dkr]y|jdd|gƒWqºtk rY}zt|ƒ‚WYdd}~XqºXn]y)|j|j||d|g|ƒWn1tk r¹}zt|ƒ‚WYdd}~XnXdS(Nu.rcurcu-ru-o(uspawnuDistutilsExecErroru CompileErroru compiler_so(uselfuobjusrcuextucc_argsuextra_postargsupp_optsumsg((u;/opt/alt/python33/lib64/python3.3/distutils/emxccompiler.pyu_compileKs " uEMXCCompiler._compilecCs‰tj| pgƒ} tj|p$gƒ}tj|p9gƒ}|j|jƒ|dk r;||jkr;tjj|dƒ}tjjtjj |ƒƒ\}}tjj ||dƒ}dtjjtjj |ƒƒdddg}x|D]}|j d|ƒqóW|j t ||fd|ƒ|j |ƒn| sQ| j dƒntj||||||||d| | | | | ƒdS( Niu.defu$LIBRARY %s INITINSTANCE TERMINSTANCEuDATA MULTIPLE NONSHAREDuEXPORTSu "%s"u writing %su-s(ucopyuextendu dll_librariesuNoneu EXECUTABLEuosupathudirnameusplitextubasenameujoinuappenduexecuteu write_fileu UnixCCompilerulink(uselfu target_descuobjectsuoutput_filenameu output_diru librariesu library_dirsuruntime_library_dirsuexport_symbolsudebugu extra_preargsuextra_postargsu build_tempu target_langutemp_dirudll_nameu dll_extensionudef_fileucontentsusym((u;/opt/alt/python33/lib64/python3.3/distutils/emxccompiler.pyulinkYsF         uEMXCCompiler.linkucCsó|dkrd}ng}xÑ|D]É}tjjtjj|ƒƒ\}}||jdgkr{td||fƒ‚n|r–tjj|ƒ}n|dkrÈ|jtjj |||j ƒƒq"|jtjj |||j ƒƒq"W|S(Nuu.rcu"unknown file type '%s' (from '%s')( uNoneuosupathusplitextunormcaseusrc_extensionsuUnknownFileErrorubasenameuappendujoinu res_extensionu obj_extension(uselfusource_filenamesu strip_diru output_diru obj_namesusrc_nameubaseuext((u;/opt/alt/python33/lib64/python3.3/distutils/emxccompiler.pyuobject_filenames´s   $ uEMXCCompiler.object_filenamesc Cs¸d|}d|}ytjdjdƒ}Wntk rHg}YnXxh||D]\}tjj||ƒ}tjj||ƒ} tjj|ƒrš|Stjj| ƒrT| SqTWdS(Nu%s.libu lib%s.libu LIBRARY_PATHu;(uosuenvironusplituKeyErrorupathujoinuexistsuNone( uselfudirsulibudebugushortlibulonglibuemx_dirsudiru shortlibpulonglibp((u;/opt/alt/python33/lib64/python3.3/distutils/emxccompiler.pyufind_library_fileÏs    uEMXCCompiler.find_library_fileN(u__name__u __module__u __qualname__u compiler_typeu obj_extensionustatic_lib_extensionushared_lib_extensionustatic_lib_formatushared_lib_formatu res_extensionu exe_extensionu__init__u_compileuNoneulinkuobject_filenamesufind_library_file(u __locals__((u;/opt/alt/python33/lib64/python3.3/distutils/emxccompiler.pyu EMXCCompilers2 Pu EMXCCompileruokunot oku uncertaincCsàddlm}tjjdƒdkr2tdfS|jƒ}y.t|ƒ}z|jƒ}Wd|j ƒXWn<t k rª}zt d||j ffSWYdd}~Xn2X|jdƒdkrÎtd|fSt d |fSdS( u¡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(u sysconfiguGCCusys.version mentions 'GCC'Nucouldn't read '%s': %su__GNUC__u'%s' mentions '__GNUC__'u '%s' does not mention '__GNUC__'(u distutilsu sysconfigusysuversionufindu CONFIG_H_OKuget_config_h_filenameuopenureaducloseuIOErroruCONFIG_H_UNCERTAINustrerroruCONFIG_H_NOTOK(u sysconfigufnufusuexc((u;/opt/alt/python33/lib64/python3.3/distutils/emxccompiler.pyucheck_config_hïs   'ucheck_config_hc CsÇddlm}ddlm}ddl}|dƒ}|r±tj|ddƒ}z|jƒ}Wd|jƒX|j d||j ƒ}|r¨||j d ƒƒ}q·d}nd}d}||fS( ua Try to find out the versions of gcc and ld. If not possible it returns None for it. i(u StrictVersion(ufind_executableNugccu -dumpversionuru(\d+\.\d+\.\d+)i( udistutils.versionu StrictVersionudistutils.spawnufind_executableureuosupopenureaducloseusearchuASCIIugroupuNone( u StrictVersionufind_executableureugcc_exeuoutu out_stringuresultu gcc_versionu ld_version((u;/opt/alt/python33/lib64/python3.3/distutils/emxccompiler.pyu get_versions"s     u get_versions(u__doc__uosusysucopyudistutils.ccompilerugen_preprocess_optionsugen_lib_optionsudistutils.unixccompileru UnixCCompilerudistutils.file_utilu write_fileudistutils.errorsuDistutilsExecErroru CompileErroruUnknownFileErroru distutilsulogu EMXCCompileru CONFIG_H_OKuCONFIG_H_NOTOKuCONFIG_H_UNCERTAINucheck_config_hu get_versions(((u;/opt/alt/python33/lib64/python3.3/distutils/emxccompiler.pyus$Î 3