util: Allow '#' comments in u_format.csv.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 24 Feb 2010 13:47:42 +0000 (13:47 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 24 Feb 2010 15:45:28 +0000 (15:45 +0000)
src/gallium/auxiliary/util/u_format_parse.py

index 5d49fc7652b82e774d982b1dff4e474604454422..37336029d8903424853f7ae1b3f1daf27244433c 100755 (executable)
@@ -137,7 +137,15 @@ def parse(filename):
     stream = open(filename)
     formats = []
     for line in stream:
-        line = line.rstrip()
+        try:
+            comment = line.index('#')
+        except ValueError:
+            pass
+        else:
+            line = line[:comment]
+        line = line.strip()
+        if not line:
+            continue
         fields = [field.strip() for field in line.split(',')]
         name = fields[0]
         layout = fields[1]