diff options
author | Kenneth Graunke <kenneth@whitecape.org> | 2010-08-23 12:36:40 -0700 |
---|---|---|
committer | Kenneth Graunke <kenneth@whitecape.org> | 2010-08-23 12:36:40 -0700 |
commit | 6355ae2b80a01b1d58824ffeae0c638d917519c0 (patch) | |
tree | b2828cb0f68f76cc0ee8dc24901a7e148713589b /src | |
parent | 4ab1001ac28b5716e1b103df44d04b8a8ddd2375 (diff) |
generate_builtins.py: Generate output in sorted order.
Diffstat (limited to 'src')
-rwxr-xr-x | src/glsl/builtins/tools/generate_builtins.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index d793c28443..2a763d784b 100755 --- a/src/glsl/builtins/tools/generate_builtins.py +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -1,7 +1,8 @@ #!/usr/bin/python # -*- coding: UTF-8 -*- -import re, glob +import re +from glob import glob from os import path from subprocess import Popen, PIPE @@ -12,7 +13,7 @@ builtins_dir = path.join(path.dirname(path.abspath(__file__)), "..") # 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() @@ -29,7 +30,7 @@ def stringify(s): 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), ';' @@ -74,7 +75,7 @@ def write_profile(filename, profile): 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 '};' @@ -85,7 +86,7 @@ def write_profiles(): 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 |