U  e @s|ddlmZddlmZddlmZddlZddlmZddlm Z ddl m Z dd Z d d Z dd d ZedkrxedS))ArgumentParser)dirname)isfileN) exceptions)TemplateLookup)TemplatecCsd|kr|dfS|ddS)N=)split)varr 6/opt/hc_python/lib/python3.8/site-packages/mako/cmd.pyvarsplitsrcCs"tjttddS)Nr )sysstderrwriterZtext_error_templaterenderexitr r r r_exitsrc Csxt}|jdgddd|jdgddd|jdddd |jd dd d |jd d dd||}|j}|j}|jdkr|jpdg}t|}ztt j ||d}Wnt YnXnX|j}t |std||jpt|g}t|}zt|||d}Wnt YnXtdd|jD} z|jf| } Wnt Yn*X|rht|d|d| n t j| dS)Nz--varappendz5variable (can be used multiple times, use name=value))defaultactionhelpz--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-encodingzforce output encoding)rrz --output-filez6Write to file upon successful render instead of stdoutinput?-)nargsr.)lookupoutput_encodingzerror: can't find %s)filenamerr css|]}t|VqdS)N)r).0r r r r Vszcmdline..wt)encoding)r add_argument parse_argsr output_filerZ template_dirrrrstdinreadrr SystemExitrdictr ropenrstdout) argvparseroptionsr r(Z lookup_dirsrtemplater!kwrenderedr r rcmdlinesv         r5__main__)N)argparseros.pathrrrmakorZ mako.lookuprZ mako.templaterrrr5__name__r r r rs       G