#!/usr/bin/python
# -*- coding: UTF-8 -*-
-import re, glob
+import re
+from glob import glob
from os import path
from subprocess import Popen, PIPE
# Read the files in builtins/ir/*...add them to the supplied dictionary.
def read_ir_files(fs):
- for filename in glob.glob(path.join(path.join(builtins_dir, 'ir'), '*')):
+ for filename in glob(path.join(path.join(builtins_dir, 'ir'), '*')):
with open(filename) as f:
fs[path.basename(filename)] = f.read()
def write_function_definitions():
fs = get_builtin_definitions()
- for k, v in fs.iteritems():
+ for k, v in sorted(fs.iteritems()):
print 'static const char *builtin_' + k + ' ='
print stringify(v), ';'
function_names.add(func.group(1))
print 'static const char *functions_for_' + profile + ' [] = {'
- for func in function_names:
+ for func in sorted(function_names):
print ' builtin_' + func + ','
print '};'
def get_profile_list():
profiles = []
- for pfile in glob.glob(path.join(path.join(builtins_dir, 'profiles'), '*')):
+ for pfile in sorted(glob(path.join(path.join(builtins_dir, 'profiles'), '*'))):
profiles.append((pfile, path.basename(pfile).replace('.', '_')))
return profiles