Submit
Path:
~
/
/
usr
/
lib64
/
python2.7
/
site-packages
/
Cheetah
/
File Content:
ImportHooks.pyo
� [Z-Lc @ s d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z e a g a d � Z d e f d � � YZ d d � Z d � Z e d k re � n d S( 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() i����N( t RLock( t ImportManager( t DirOwner( t Compiler( t convertTmplPathToModuleNamec C s t j | � d S( N( t _cacheDirt append( t cacheDir( ( s9 /usr/lib64/python2.7/site-packages/Cheetah/ImportHooks.pyt setCacheDir! s t CheetahDirOwnerc B s; e Z e � Z e j Z e j Z d Z d � Z d � Z RS( s .tmplc C s� | j � z� t j | | � } | r) | Sx� | j D]� } t j j | j | | � } t j j | � r3 y | j | | � SWq� t j � } d d j | j � � } t d t � � � q� Xq3 q3 Wd SWd | j � Xd S( Ns s sV Error while compiling Cheetah module %(name)s, original traceback follows: %(exc_txt)s( t _acquireLockR t getmodt templateFileExtensionst ost patht joint existst _compilet tracebackt format_exct splitlinest ImportErrort localst Nonet _releaseLock( t selft namet modt extt tmplPatht exc_txt( ( s9 /usr/lib64/python2.7/site-packages/Cheetah/ImportHooks.pyR / s$ c C s� t t d | d | d | � � } t r� t j j t d t | � � d } y t | d � j | � Wq� t k r� t j d t j � | } q� Xn | } t | d | d � } t j | � } | j | _ t r� | | _ n | | _ | S( Nt filet moduleNamet mainClassNamei s .pyt ws t exec( t strR R R R R R t opent writet OSErrorR t print_exct syst stderrt compilet typest ModuleTypet co_filenamet __file__t __orig_file__t __co__( R R R t codeR/ t coR ( ( s9 /usr/lib64/python2.7/site-packages/Cheetah/ImportHooks.pyR H s$ ( s .tmpl( t __name__t __module__R t _lockt acquireR t releaseR R R R ( ( ( s9 /usr/lib64/python2.7/site-packages/Cheetah/ImportHooks.pyR ( s s .tmplc C sv t sr | t _ d d l } t | j t j � rr | j a t j j d t � t j � a t j � t j � qr n d S( s Install the Cheetah Import Hooksi����Ni ( t _installedR R t __builtin__t isinstancet __import__R, t BuiltinFunctionTypet __oldimport__R t _globalOwnerTypest insertt _managert setThreadedt install( R R: ( ( s9 /usr/lib64/python2.7/site-packages/Cheetah/ImportHooks.pyRC e s c C s= t s9 d d l } t | j t j � r9 t | _ b q9 n d S( s"