ó
ìŠ'Gc           @   s:   d  d l  Z  d  d l Z d  d l Z g  Z d d „ Z d S(   iÿÿÿÿNt   templatec         C   sÒ  t  j } | d k r' t  j j ƒ  } n t  j j ƒ  } |  j d ƒ d k  rT i  } n9 d d l } |  j d d ƒ \ }  } t | j	 | ƒ ƒ } x© | D]1 } t
 j j | |  ƒ } t
 j j | ƒ r” Pq” q” W| j d | |  ƒ | t k r5| j d | ƒ x* | D]" } | j d	 t
 j j | ƒ ƒ qÿ Wt j | ƒ n  d St
 j j | ƒ } t
 j j t j d d
 d ƒ }	 |	 t j k rŒt j j |	 ƒ n  t
 j j t
 j j | ƒ ƒ \ }
 } | d } y. y t d | ƒ } Wn t | ƒ } n XWn) t k
 r} | j d | | | | ƒ SXt  j j |  ƒ } | d k r?|  | d <n  | j | ƒ | j d | t
 j j | ƒ | ƒ | d k r| j | | d | ƒ St  j j ƒ  } t
 j j | |
 ƒ } | j | | | | ƒ | Sd S(   sA    select a template module based on file extension and execute it R    t   ?i    iÿÿÿÿNi   s   Unable to locate %s %ss   %s search path:s       %st   planett   shellt   _s/   Skipping %s '%s' after failing to load '%s': %st   plugint   __file__s   Processing %s %s using %st   filter(   R   t   loggert   configt   template_directoriest   filter_directoriest   findt   cgit   splitt   dictt	   parse_qslt   ost   patht   joint   existst   errort   logged_modest   infot   realpatht   appendt   syst   splitextt   basenamet
   __import__t	   Exceptiont   template_optionst   updatet   debugt   runt   Nonet
   output_dir(   t   template_filet   doct   modet   logt   dirst   extra_optionsR   t   template_dirt   template_resolvedt	   shellpatht   baset   extt   module_namet   modulet   instt   optionsR$   t   output_file(    (    sF   /home/sa3ruby/intertwingly.net/code/venus-bzr/planet/shell/__init__.pyR"      s\    		  $
	 (   R   R   R   R   R"   (    (    (    sF   /home/sa3ruby/intertwingly.net/code/venus-bzr/planet/shell/__init__.pyt   <module>   s   