
    +h
                         d dl mZ d dlmZ d dlmZ d dlZd dlmZ d dlm	Z	 d dl
mZ d Zd	 Zdd
Zedk(  r e        yy)    )ArgumentParser)dirname)isfileN)
exceptions)TemplateLookup)Templatec                 6    d| vr| dfS | j                  dd      S )N=    )split)vars    ;/var/www/html/venv/lib/python3.12/site-packages/mako/cmd.pyvarsplitr      s$    
#~Ry99S!    c                      t         j                  j                  t        j                         j                                t        j                  d       y )Nr   )sysstderrwriter   text_error_templaterenderexit r   r   _exitr      s1    JJZ335<<>?HHQKr   c                    t               }|j                  dg dd       |j                  dg dd       |j                  dd d	       |j                  d
d d	       |j                  ddd       |j                  |       }|j                  }|j                  }|j
                  dk(  rH|j                  xs dg}t        |      }	 t        t        j                  j                         ||      }nY|j
                  }t        |      st        d|z        |j                  xs t        |      g}t        |      }	 t        |||      }t!        d |j"                  D              }		  j$                  di |	}
|rt'        |d|      j)                  |
       y t        j*                  j)                  |
       y #  t                Y }xY w#  t                Y xY w#  t                Y y xY w)Nz--varappendz5variable (can be used multiple times, use name=value))defaultactionhelpz--template-dirzDirectory to use for template lookup (multiple directories may be provided). If not given then if the template is read from stdin, the value defaults to be the current directory, otherwise it defaults to be the parent directory of the file provided.z--output-encodingzforce output encoding)r   r   z--output-filez6Write to file upon successful render instead of stdoutinput?-)nargsr   .)lookupoutput_encodingzerror: can't find %s)filenamer%   r&   c              3   2   K   | ]  }t        |        y wN)r   ).0r   s     r   	<genexpr>zcmdline.<locals>.<genexpr>V   s     3hsm3s   wt)encodingr   )r   add_argument
parse_argsr&   output_filer    template_dirr   r   r   stdinreadr   r   
SystemExitr   dictr   r   openr   stdout)argvparseroptionsr&   r0   lookup_dirsr%   templater'   kwrendereds              r   cmdliner?      s   F
D	   1	  	 T0G   E  
 sC8%G--O%%K}}**3se,			  /H ==h3h>??**Awx/@.A,	! /H 
3w{{3	3B'"8??(R( d_=CCHMJJX&5	G	G
s$   *F9 <G
 'G 9G
GG)__main__r)   )argparser   os.pathr   r   r   makor   mako.lookupr   mako.templater   r   r   r?   __name__r   r   r   <module>rG      sA    $   
  & "
D'N zI r   