ha-Kc @ s? d Z d d k Z d d k Z d d k Z e Z d a a a a d Z e d Z d Z d Z d Z d Z d d d YZ d e f d YZ d e f d YZ d e f d YZ d e f d YZ d e f d YZ d e f d YZ d Z d d d YZ e e g Z d S( s] Provides an emulator/replacement for Python's standard import system. @@TR: Be warned that Import Hooks are in the deepest, darkest corner of Python's jungle. If you need to start hacking with this, be prepared to get lost for a while. Also note, this module predates the newstyle import hooks in Python 2.3 http://www.python.org/peps/pep-0302.html. This is a hacked/documented version of Gordon McMillan's iu.py. I have: - made it a little less terse - added docstrings and explanatations - standardized the variable naming scheme - reorganized the code layout to enhance readability iNc C sY t i } d } } d | j o d } d d k l } l } n d | j o d } d d k l } l } n d | j o d } d d k l } l } nj d | j o d } d d k l } l } n= d | j o# d d k l } l } d } n t d | d j o | d } n | d j o | d } n | a | a | a | a d S( sI Set up 'os' module replacement functions for use during import bootstrap.t posixt /i( t statt getcwdt nts \t dost os2t macc S sT | d j o | Sd | j o d | } n | d d j o | d } n | | S( Nt t :i( ( t at b( ( s; /usr/lib64/python2.6/site-packages/Cheetah/ImportManager.pyt join7 s s no os specific module foundc S sK | d j o | S| d } | d j p | | j o | | S| | | S( NR iR ( ( R R t sept lastchar( ( s; /usr/lib64/python2.6/site-packages/Cheetah/ImportManager.pyR C s c S sX xQ t t | d d d D]3 } | | } | d j p | | j o | | Sq Wd S( Ni iR R ( t ranget len( R R t it c( ( s; /usr/lib64/python2.6/site-packages/Cheetah/ImportManager.pyt dirnameL s N( t syst builtin_module_namest NoneR R R R R R R t ImportErrort _os_statt _os_path_joint _os_path_dirnamet _os_getcwd( t namesR R R R R ( ( s; /usr/lib64/python2.6/site-packages/Cheetah/ImportManager.pyt _os_bootstrap# s4 c C sI x> t t | d d d D] } | | d j o Pq q Wd S| | S( Ni it .R ( R R ( t sR ( ( s; /usr/lib64/python2.6/site-packages/Cheetah/ImportManager.pyt packageNamea s c C s g } d } } xM t t | D]9 } | | d j o" | i | | | ! | d } q# q# W| t | j o | i | | n | S( Ni R i ( R R t append( R t rsltR t j( ( s; /usr/lib64/python2.6/site-packages/Cheetah/ImportManager.pyt nameSpliti s c C sE x> t t | d d d D] } | | d j o | | Sq Wd S( Ni iR R ( R R ( t fnmR ( ( s; /usr/lib64/python2.6/site-packages/Cheetah/ImportManager.pyt getPathExtt s c C s9 y t | } Wn t j o d SX| d d @d j S( s&