generate_builtins.py: Generate output in sorted order.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 23 Aug 2010 19:36:40 +0000 (12:36 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 23 Aug 2010 19:36:40 +0000 (12:36 -0700)
src/glsl/builtins/tools/generate_builtins.py

index d793c284435def0ad6c64849671bf19a44f2868b..2a763d784b4121a5d0bec364bbd99c6d53ab8f12 100755 (executable)
@@ -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