o
    `^h|                     @   sD   d dl Z d dlZd dlmZ dddZdd Zedkr e  dS dS )	    N)Tempitac                 C   s   t | ddd}| }W d   n1 sw   Y  t|}| }t |ddd}|| W d   dS 1 s<w   Y  dS )zProcess tempita templated file and write out the result.

    The template file is expected to end in `.c.tp` or `.pyx.tp`:
    E.g. processing `template.c.in` generates `template.c`.

    rzutf-8)encodingNw)openreadtempitaTemplate
substitutewrite)fromfileoutfileftemplate_contenttemplatecontent r   Z/home/air/shanriGPT/back/venv/lib/python3.10/site-packages/sklearn/_build_utils/tempita.pyprocess_tempita   s   

"r   c                  C   s   t  } | jdtdd | jddtdd | jddtd	d |  }|jd
s0td|j |js7tdt	j
t	 |j}t	j
|t	j
t	j
|jd d }t|j| d S )NinfilezPath to the input file)typehelpz-oz--outdirzPath to the output directoryz-iz--ignorezKAn ignored input - may be useful to add a dependency between custom targetsz.tpzUnexpected extension: z)Missing `--outdir` argument to tempita.py   r   )argparseArgumentParseradd_argumentstr
parse_argsr   endswith
ValueErroroutdirospathjoingetcwdsplitextsplitr   )parserargs
outdir_absr   r   r   r   main   s&   	r*   __main__)N)r   r!   Cythonr   r   r   r*   __name__r   r   r   r   <module>   s   

