3 \\ã@s‚ddlZddlZddlmZmZmZmZmZddlm Z m Z m Z ddl m Z dZy,ddlZdZeZejZejZejZejZWnhek räy4ddlZddlZdZeZejZejZejZejZWnek rÞe jdƒYnXYnXerþejejejej fZ!dd „Z"d d „Z#d d „Z$Gdd„dƒZ%dd„Z&dd„Z'dd„Z(Gdd„de ƒZ)e&ƒdk�r~e j*dƒe)Z+ddl,m)Z)ddl,m%Z%dS)éN)ÚDistutilsExecErrorÚDistutilsPlatformErrorÚ CompileErrorÚLibErrorÚ LinkError)Ú CCompilerÚgen_preprocess_optionsÚgen_lib_options)ÚlogFTz�Warning: 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 k�r>|}d|}y"|j|jg| |g|gƒWqhtk �r8}zt|ƒ‚WYdd}~XqhXqhnÒ||jk�rtj j|ƒ}tj j|ƒ}yl|j|jgd|d|g|gƒtj jtj j|ƒƒ\}}tj j||dƒ}|j|jgd|g|gƒWqhtk �rú}zt|ƒ‚WYdd}~XqhXqhntd||fƒ‚d |}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_compilerÚextendrhrgr/rMr-ÚabspathÚ _c_extensionsÚ_cpp_extensionsrrÚspawnrbrrrtÚdirnamercrmrqrfr`)r)Zsourcesrvr'Z include_dirsÚdebugÚ extra_preargsÚextra_postargsZdependsZ compile_infoÚobjectsZpp_optsZbuildZ compile_optsÚobjÚsrcrwZ input_optZ output_optÚmsgZh_dirZrc_dirrÚ_Zrc_filerrrÚcompileWsj              zMSVCCompiler.compilec Csž|js|jƒ|j||ƒ\}}|j||d�}|j||ƒrŽ|d|g}|rJy|j|jg|ƒWqštk rŠ}zt|ƒ‚WYdd}~XqšXn t j d|ƒdS)N)rvz/OUT:zskipping %s (up-to-date)) rXrkÚ_fix_object_argsÚlibrary_filenameÚ _need_linkr}rZrrr r) r)r‚Zoutput_libnamervrÚ target_langÚoutput_filenameZlib_argsr…rrrÚcreate_static_lib¬s 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|pÊgD]}|jd|ƒqÌW||||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))rXrkrˆZ _fix_lib_argsÚwarnÚstrr rMr-rfrŠrZ EXECUTABLErjrirrmrqr~r‰ryZmkpathr}rarrr r)r)Z target_descr‚rŒrvZ librariesZ library_dirsZruntime_library_dirsZexport_symbolsrr€r�Z build_tempr‹Z fixed_argsZlib_optsZldflagsZ export_optsZsymZld_argsZdll_nameZdll_extZ implib_filer…rrrÚlinkÅsV       zMSVCCompiler.linkcCsd|S)Nz /LIBPATH:r)r)ÚdirrrrÚlibrary_dir_optionszMSVCCompiler.library_dir_optioncCs tdƒ‚dS)NztjdjdƒD]*}tjjtjj|ƒ|ƒ}tjj|ƒrH|SqHW|S)NZPathr\)r]rMr-rfrzÚisfiler^rD)r)Zexer1Úfnrrrr_5s   zMSVCCompiler.find_exeÚx86cCsÀtsgS|d}|jdkr,d|j|jf}nd|j|f}xHtD]@}t||ƒ}|r@|jdkrr|jj||ƒjdƒS||jdƒSq@W|jdkr¼x,tD]$}t|d|jƒdk r”|jdƒPq”WgS) 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.0z´It 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+rkrxr‡r�r�r’r“r”r—r_rdrerrrrrQÈsN  B  V  F  $rQg @z3Importing new compiler from distutils.msvc9compiler)rQ)r&)-rArMZdistutils.errorsrrrrrZdistutils.ccompilerrrr Z distutilsr r›ÚwinregZhkey_modZ OpenKeyExr ZEnumKeyrZ EnumValuerÚerrorr Ú ImportErrorZwin32apiZwin32conÚinfoZ HKEY_USERSÚHKEY_CURRENT_USERÚHKEY_LOCAL_MACHINEZHKEY_CLASSES_ROOTr,rr rr&rHrLrPrQrZOldMSVCCompilerZdistutils.msvc9compilerrrrrÚ s\      - 9