Ńň ha-Kc@s%dZdZddd!ZddkZddkZddkZddkZddkZddk Z ddk l Z ddk Z ddk Z ddklZdd klZdd klZdd klZeagad „Zd efd„ƒYZdd„Zd„Zedjo eƒndS(s"Provides some import hooks to allow Cheetah's .tmpl files to be imported directly like Python .py modules. To use these: import Cheetah.ImportHooks Cheetah.ImportHooks.install() Meta-Data ================================================================================ Author: Tavis Rudd License: This software is released for unlimited distribution under the terms of the MIT license. See the LICENSE file. Version: $Revision: 1.27 $ Start Date: 2001/03/30 Last Revision Date: $Date: 2007/11/16 18:28:47 $ s!Tavis Rudd s$Revision: 1.27 $i iţ˙˙˙i˙˙˙˙N(tRLock(t ImportManager(tDirOwner(tCompiler(tconvertTmplPathToModuleNamecCsti|ƒdS(N(t _cacheDirtappend(tcacheDir((s9/usr/lib64/python2.6/site-packages/Cheetah/ImportHooks.pyt setCacheDir*stCheetahDirOwnercBs;eZeƒZeiZeiZdZd„Z d„Z RS(s.tmplc Csß|iƒzĂti||ƒ}|o|Sxš|iD]}tii|i||ƒ}tii|ƒoZy|i||ƒSWqÄt i ƒ}ddi|i ƒƒ}t dt ƒƒ‚qÄXq5q5WdSWd|iƒXdS(Ns s sVError while compiling Cheetah module %(name)s, original traceback follows: %(exc_txt)s(t _acquireLockRtgetmodttemplateFileExtensionstostpathtjointexistst_compilet tracebackt format_exct splitlinest ImportErrortlocalstNonet _releaseLock(tselftnametmodtextttmplPathtexc_txt((s9/usr/lib64/python2.6/site-packages/Cheetah/ImportHooks.pyR 8s&   cCsđttd|d|d|ƒƒ}toptiitdt|ƒƒd}yt|dƒi|ƒWqžt j o t i dt i ƒ|}qžXn|}t|d|dƒ}ti|ƒ}|i|_to ||_n||_|S( Ntfilet moduleNamet mainClassNameis.pytws texec(tstrRRR RRRtopentwritetOSErrorRt print_exctsyststderrtcompiletimpt new_modulet co_filenamet__file__t __orig_file__t__co__(RRRtcodeR/tcoR((s9/usr/lib64/python2.6/site-packages/Cheetah/ImportHooks.pyRQs$    (s.tmpl( t__name__t __module__Rt_locktacquireR treleaseRR R R(((s9/usr/lib64/python2.6/site-packages/Cheetah/ImportHooks.pyR 1s     s.tmplcCsztpo|t_ddk}t|itiƒo@|iat i i dtƒt i ƒa t i ƒt iƒqvndS(s Install the Cheetah Import Hooksi˙˙˙˙Ni(t _installedR R t __builtin__t isinstancet __import__ttypestBuiltinFunctionTypet __oldimport__Rt_globalOwnerTypestinsertt_managert setThreadedtinstall(R R:((s9/usr/lib64/python2.6/site-packages/Cheetah/ImportHooks.pyRDns     cCsAtp6ddk}t|itiƒot|_bq=ndS(s"Uninstall the Cheetah Import Hooksi˙˙˙˙N(R9R:R;R<R=t MethodTypeR?RB(R:((s9/usr/lib64/python2.6/site-packages/Cheetah/ImportHooks.pyt uninstalls   t__main__(s.tmpl(t__doc__t __author__t __revision__R)tos.pathR R=R:tnewR,t threadingRtstringRtCheetahRtCheetah.ImportManagerRtCheetah.CompilerRt#Cheetah.convertTmplPathToModuleNameRtFalseR9RRR RDRFR4(((s9/usr/lib64/python2.6/site-packages/Cheetah/ImportHooks.pyts.          =