3 \\@sddlZddlZddlmZmZmZmZmZddlm Z m Z m Z ddl m Z dZy,ddlZdZeZejZejZejZejZWnhek ry4ddlZddlZdZeZejZejZejZejZWnek re jdYnXYnXerejejejej fZ!dd Z"d d Z#d d Z$GdddZ%ddZ&ddZ'ddZ(Gddde Z)e&dkr~e j*de)Z+ddl,m)Z)ddl,m%Z%dS)N)DistutilsExecErrorDistutilsPlatformError CompileErrorLibError LinkError) CCompilergen_preprocess_optionsgen_lib_options)logFTzWarning: Can't read registry to find the necessary compiler setting Make sure that Python modules winreg, win32api or win32con are installed.cCsnyt||}Wntk r"dSXg}d}x||j kr>|}d|}y"|j|jg| |g|gWqhtk r8}zt|WYdd}~XqhXqhn||jkrtj j|}tj j|}yl|j|jgd|d|g|gtj jtj j|\}}tj j||d}|j|jgd|g|gWqhtk r}zt|WYdd}~XqhXqhntd||fd |}y&|j|jg| | ||g|Wqhtk rj}zt|WYdd}~XqhXqhW| S) Nz/cz/Tcz/Tpz/foz-hz-rz.rcz"Don't know how to compile %s to %sz/Fo)rXrkZ_setup_compilerextendrhrgr/rMr-abspath _c_extensions_cpp_extensionsrrspawnrbrrrtdirnamercrmrqrfr`)r)Zsourcesrvr'Z include_dirsdebug extra_preargsextra_postargsZdependsZ compile_infoobjectsZpp_optsZbuildZ compile_optsobjsrcrwZ input_optZ output_optmsgZh_dirZrc_dirr_Zrc_filerrrcompileWsj              zMSVCCompiler.compilec Cs|js|j|j||\}}|j||d}|j||r|d|g}|rJy|j|jg|Wqtk r}zt|WYdd}~XqXn t j d|dS)N)rvz/OUT:zskipping %s (up-to-date)) rXrk_fix_object_argslibrary_filename _need_linkr}rZrrr r) r)rZoutput_libnamervr target_langoutput_filenameZlib_argsrrrrcreate_static_libs zMSVCCompiler.create_static_libcCs|js|j|j||\}}|j|||}|\}}}|rL|jdt|t||||}|dk rptjj ||}|j ||r|t j kr| r|j dd}q|jdd}n| r|j }n|j}g}x|pgD]}|jd|qW||||d|g}|dk rLtjjtjj|\}}tjj tjj|d|j|}|jd|| r^| |dd<| rn|j| |jtjj|y|j|jg|Wn,tk r}zt|WYdd}~XnXn tjd|dS)Nz5I don't know what to do with 'runtime_library_dirs': r z/EXPORT:z/OUT:rz/IMPLIB:zskipping %s (up-to-date))rXrkrZ _fix_lib_argswarnstrr rMr-rfrrZ EXECUTABLErjrirrmrqr~rryZmkpathr}rarrr r)r)Z target_descrrrvZ librariesZ library_dirsZruntime_library_dirsZexport_symbolsrrrZ build_temprZ fixed_argsZlib_optsZldflagsZ export_optsZsymZld_argsZdll_nameZdll_extZ implib_filerrrrlinksV       zMSVCCompiler.linkcCsd|S)Nz /LIBPATH:r)r)dirrrrlibrary_dir_optionszMSVCCompiler.library_dir_optioncCs tddS)NztjdjdD]*}tjjtjj||}tjj|rH|SqHW|S)NZPathr\)r]rMr-rfrzisfiler^rD)r)Zexer1fnrrrr_5s   zMSVCCompiler.find_exex86cCstsgS|d}|jdkr,d|j|jf}nd|j|f}xHtD]@}t||}|r@|jdkrr|jj||jdS||jdSq@W|jdkrx,tD]$}t|d|jdk r|jdPqWgS) Nz dirsrRz6%s\%0.1f\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directoriesz?%s\6.0\Build System\Components\Platforms\Win32 (%s)\Directoriesr\r:z%s\6.0zIt seems you have Visual Studio 6 installed, but the expected registry settings are not present. You must at least run the Visual Studio GUI once so that these entries are created.) _can_read_regrSrUr,r rVr6rDr)r)r-platformrrrrrrrdKs(        zMSVCCompiler.get_msvc_pathscCs6|dkr|jd}n |j|}|r2dj|tj|<dS)NrZZlibraryr\)rdrfrMr^)r)rr1rrrreos   zMSVCCompiler.set_path_env_var)rrr)rrl)NNNrNNN)NrN) NNNNNrNNNN)r)r)r7r8r9Z compiler_typeZ executablesr{r|rrrtrprsruZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionr+rkrxrrrrrrrr_rdrerrrrrQsN  B  V  F  $rQg @z3Importing new compiler from distutils.msvc9compiler)rQ)r&)-rArMZdistutils.errorsrrrrrZdistutils.ccompilerrrr Z distutilsr rwinregZhkey_modZ OpenKeyExr ZEnumKeyrZ EnumValuererrorr ImportErrorZwin32apiZwin32coninfoZ HKEY_USERSHKEY_CURRENT_USERHKEY_LOCAL_MACHINEZHKEY_CLASSES_ROOTr,rr rr&rHrLrPrQrZOldMSVCCompilerZdistutils.msvc9compilerrrrr s\      - 9