#NEWLINE# def process_tempita_pyx( fromfile , tofile ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# from Cython import Tempita as tempita #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# import tempita #NEWLINE# #UNINDENT# #UNINDENT# except ImportError : #NEWLINE# #INDENT# raise Exception ( 'Building PyFunt requires Tempita: pip install --user Tempita' ) #NEWLINE# #UNINDENT# from_filename = tempita . Template . from_filename #NEWLINE# template = from_filename ( fromfile , encoding = sys . getdefaultencoding ( ) ) #NEWLINE# pyxcontent = template . substitute ( ) #NEWLINE# assert fromfile . endswith ( '.pyx.in' ) #NEWLINE# pyxfile = ( fromfile [ : ( - len ( '.pyx.in' ) ) ] + '.pyx' ) #NEWLINE# with open ( pyxfile , 'w' ) as f : #NEWLINE# #INDENT# f . write ( pyxcontent ) #NEWLINE# #UNINDENT# process_pyx ( pyxfile , tofile )