From: Kenneth Graunke Date: Mon, 23 Aug 2010 19:36:40 +0000 (-0700) Subject: generate_builtins.py: Generate output in sorted order. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6355ae2b80a01b1d58824ffeae0c638d917519c0;p=mesa.git generate_builtins.py: Generate output in sorted order. --- diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py index d793c284435..2a763d784b4 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