from Cython.Build import cythonize rngs = [ 'RNG_PCG32', 'RNG_PCG64', 'RNG_MT19937', 'RNG_XORSHIFT128', 'RNG_XORSHIFT1024', 'RNG_MRG32K3A', 'RNG_MLFG_1279_861' ] files = glob.glob('./*.in') for templated_file in files: output_file_name = os.path.splitext(templated_file)[0] if os.path.exists(output_file_name): if os.path.getmtime(templated_file) < os.path.getmtime( output_file_name): continue with open(templated_file, 'r') as source_file: template = tempita.Template(source_file.read()) with open(output_file_name, 'w') as output_file: output_file.write(template.substitute()) with open('config.pxi', 'w') as config: config.write('# Autogenerated\n\n') config.write("DEF RS_RNG_MOD_NAME='mt19937'\n") pwd = getcwd() sources = [ join(pwd, 'randomstate.pyx'), join(pwd, 'src', 'common', 'entropy.c'), join(pwd, 'distributions.c') ]