when emitting CNF lines, force capitalization of variable names
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Tue, 5 Dec 2017 12:47:45 +0000 (13:47 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Mon, 5 Nov 2018 11:16:39 +0000 (12:16 +0100)
src/cnfvar.py

index 3dd7745..766e299 100644 (file)
@@ -571,6 +571,9 @@ cnf_line_child_fmt   = "%d %s(%d) %s,%d: \"%s\""
 def format_cnf_vars(da, var):
     """
     Return a list of formatted cnf_line byte strings.
+
+    The variable names are uppercased unconditionally because while ``get_cnf``
+    is case-indifferent for variable names, ``set_cnf`` isn’t.
     """
 
     depth, acc = da
@@ -578,17 +581,17 @@ def format_cnf_vars(da, var):
     if depth > 0:
         line = cnf_line_child_fmt \
             % (var["number"],
-            cnf_line_nest_indent * depth,
-            var["parent"],
-            var["varname"],
-            var["instance"],
-            var["data"])
+               cnf_line_nest_indent * depth,
+               var["parent"],
+               var["varname"].upper (),
+               var["instance"],
+               var["data"])
     else:
         line = cnf_line_base_fmt \
             % (var["number"],
-            var["varname"],
-            var["instance"],
-            var["data"])
+               var["varname"].upper (),
+               var["instance"],
+               var["data"])
 
     comment = var.get("comment", None)
     if comment and len (comment) != 0: