3 Õì2a\ã@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)rXrlZ_setup_compilerÚextendrirhr/rMr-ÚabspathÚ _c_extensionsÚ_cpp_extensionsrsÚspawnrcrrruÚdirnamerdrnrrrgra)r)Zsourcesrwr'Z include_dirsÚdebugÚ extra_preargsÚextra_postargsZdependsZ compile_infoÚobjectsZpp_optsZbuildZ compile_optsÚobjÚsrcrxZ 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)rwz/OUT:zskipping %s (up-to-date)) rXrlÚ_fix_object_argsÚlibrary_filenameÚ _need_linkr~r[rrr r€) r)rƒZoutput_libnamerwr€Ú 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))rXrlr‰Z _fix_lib_argsÚwarnÚstrr rMr-rgr‹rZ EXECUTABLErkrjrrnrrrrŠrzZmkpathr~rbrrr r€)r)Z target_descrƒr�rwZ librariesZ library_dirsZruntime_library_dirsZexport_symbolsr€r�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-rgr{Ú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-ÚplatformrrrrrrreKs(        zMSVCCompiler.get_msvc_pathscCs6|dkr|jdƒ}n |j|ƒ}|r2dj|ƒtj|<dS)Nr[Zlibraryr])rergrMr_)r)rr1rrrrfos   zMSVCCompiler.set_path_env_var)rrr)rrm)NNNrNNN)NrN) NNNNNrNNNN)r)r›)r7r8r9Z compiler_typeZ executablesr|r}rsrurqrtrvZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionr+rlryrˆrŽr‘r“r”r•r˜r`rerfrrrrrQÈ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&rHrLrPrQr€ZOldMSVCCompilerZdistutils.msvc9compilerrrrrÚ s\      - 9