Marty Plummer d5fd27
From ea7a3ac6c658164690e0febb55f4467cb9e0bcac Mon Sep 17 00:00:00 2001
Marty Plummer d5fd27
From: Thomas Klausner <wiz@NetBSD.org>
Marty Plummer d5fd27
Date: Thu, 19 May 2016 17:30:04 +0200
Marty Plummer d5fd27
Subject: Make whitespace use consistent.
Marty Plummer d5fd27
Marty Plummer d5fd27
At least python-3.5.x complains about this forcefully.
Marty Plummer d5fd27
Marty Plummer d5fd27
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
Marty Plummer d5fd27
Signed-off-by: Uli Schlachter <psychon@znc.in>
Marty Plummer d5fd27
Marty Plummer d5fd27
diff --git a/xcbgen/align.py b/xcbgen/align.py
Marty Plummer d5fd27
index 5e31838..d4c12ee 100644
Marty Plummer d5fd27
--- a/xcbgen/align.py
Marty Plummer d5fd27
+++ b/xcbgen/align.py
Marty Plummer d5fd27
@@ -16,12 +16,12 @@ class Alignment(object):
Marty Plummer d5fd27
         return self.align == other.align and self.offset == other.offset
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def __str__(self):
Marty Plummer d5fd27
-	return "(align=%d, offset=%d)" % (self.align, self.offset)
Marty Plummer d5fd27
+        return "(align=%d, offset=%d)" % (self.align, self.offset)
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     @staticmethod
Marty Plummer d5fd27
     def for_primitive_type(size):
Marty Plummer d5fd27
-	# compute the required start_alignment based on the size of the type
Marty Plummer d5fd27
-	if size % 8 == 0:
Marty Plummer d5fd27
+        # compute the required start_alignment based on the size of the type
Marty Plummer d5fd27
+        if size % 8 == 0:
Marty Plummer d5fd27
             # do 8-byte primitives require 8-byte alignment in X11?
Marty Plummer d5fd27
             return Alignment(8,0)
Marty Plummer d5fd27
         elif size % 4 == 0:
Marty Plummer d5fd27
@@ -33,7 +33,7 @@ class Alignment(object):
Marty Plummer d5fd27
 
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def align_after_fixed_size(self, size):
Marty Plummer d5fd27
-	new_offset = (self.offset + size) % self.align
Marty Plummer d5fd27
+        new_offset = (self.offset + size) % self.align
Marty Plummer d5fd27
         return Alignment(self.align, new_offset)
Marty Plummer d5fd27
 
Marty Plummer d5fd27
 
Marty Plummer d5fd27
@@ -41,7 +41,7 @@ class Alignment(object):
Marty Plummer d5fd27
         '''
Marty Plummer d5fd27
         Assuming the given external_align, checks whether
Marty Plummer d5fd27
         self is fulfilled for all cases.
Marty Plummer d5fd27
-	Returns True if yes, False otherwise.
Marty Plummer d5fd27
+        Returns True if yes, False otherwise.
Marty Plummer d5fd27
         '''
Marty Plummer d5fd27
         if self.align == 1 and self.offset == 0:
Marty Plummer d5fd27
             # alignment 1 with offset 0 is always fulfilled
Marty Plummer d5fd27
@@ -55,9 +55,9 @@ class Alignment(object):
Marty Plummer d5fd27
             # the external align guarantees less alignment -> not guaranteed
Marty Plummer d5fd27
             return False
Marty Plummer d5fd27
 
Marty Plummer d5fd27
-	if external_align.align % self.align != 0:
Marty Plummer d5fd27
+        if external_align.align % self.align != 0:
Marty Plummer d5fd27
             # the external align cannot be divided by our align
Marty Plummer d5fd27
-	    # -> not guaranteed
Marty Plummer d5fd27
+            # -> not guaranteed
Marty Plummer d5fd27
             # (this can only happen if there are alignments that are not
Marty Plummer d5fd27
             # a power of 2, which is highly discouraged. But better be
Marty Plummer d5fd27
             # safe and check for it)
Marty Plummer d5fd27
@@ -72,7 +72,7 @@ class Alignment(object):
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def combine_with(self, other):
Marty Plummer d5fd27
         # returns the alignment that is guaranteed when
Marty Plummer d5fd27
-	# both, self or other, can happen
Marty Plummer d5fd27
+        # both, self or other, can happen
Marty Plummer d5fd27
         new_align = gcd(self.align, other.align)
Marty Plummer d5fd27
         new_offset_candidate1 = self.offset % new_align
Marty Plummer d5fd27
         new_offset_candidate2 = other.offset % new_align
Marty Plummer d5fd27
@@ -83,8 +83,8 @@ class Alignment(object):
Marty Plummer d5fd27
             new_align = gcd(new_align, offset_diff)
Marty Plummer d5fd27
             new_offset_candidate1 = self.offset % new_align
Marty Plummer d5fd27
             new_offset_candidate2 = other.offset % new_align
Marty Plummer d5fd27
-	    assert new_offset_candidate1 == new_offset_candidate2
Marty Plummer d5fd27
-	    new_offset = new_offset_candidate1
Marty Plummer d5fd27
+            assert new_offset_candidate1 == new_offset_candidate2
Marty Plummer d5fd27
+            new_offset = new_offset_candidate1
Marty Plummer d5fd27
         # return the result
Marty Plummer d5fd27
         return Alignment(new_align, new_offset)
Marty Plummer d5fd27
 
Marty Plummer d5fd27
@@ -92,44 +92,44 @@ class Alignment(object):
Marty Plummer d5fd27
 class AlignmentLog(object):
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def __init__(self):
Marty Plummer d5fd27
-	self.ok_list = []
Marty Plummer d5fd27
-	self.fail_list = []
Marty Plummer d5fd27
-	self.verbosity = 1
Marty Plummer d5fd27
+        self.ok_list = []
Marty Plummer d5fd27
+        self.fail_list = []
Marty Plummer d5fd27
+        self.verbosity = 1
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def __str__(self):
Marty Plummer d5fd27
-	result = ""
Marty Plummer d5fd27
+        result = ""
Marty Plummer d5fd27
 
Marty Plummer d5fd27
-	# output the OK-list
Marty Plummer d5fd27
-	for (align_before, field_name, type_obj, callstack, align_after) in self.ok_list:
Marty Plummer d5fd27
-	    stacksize = len(callstack)
Marty Plummer d5fd27
+        # output the OK-list
Marty Plummer d5fd27
+        for (align_before, field_name, type_obj, callstack, align_after) in self.ok_list:
Marty Plummer d5fd27
+            stacksize = len(callstack)
Marty Plummer d5fd27
             indent = '  ' * stacksize
Marty Plummer d5fd27
-	    if self.ok_callstack_is_relevant(callstack):
Marty Plummer d5fd27
+            if self.ok_callstack_is_relevant(callstack):
Marty Plummer d5fd27
                 if field_name is None or field_name == "":
Marty Plummer d5fd27
-	            result += ("    %sok: %s:\n\t%sbefore: %s, after: %s\n"
Marty Plummer d5fd27
-		        % (indent, str(type_obj), indent, str(align_before), str(align_after)))
Marty Plummer d5fd27
-	        else:
Marty Plummer d5fd27
-		    result += ("    %sok: field \"%s\" in %s:\n\t%sbefore: %s, after: %s\n"
Marty Plummer d5fd27
-		        % (indent, str(field_name), str(type_obj),
Marty Plummer d5fd27
-		           indent, str(align_before), str(align_after)))
Marty Plummer d5fd27
+                    result += ("    %sok: %s:\n\t%sbefore: %s, after: %s\n"
Marty Plummer d5fd27
+                        % (indent, str(type_obj), indent, str(align_before), str(align_after)))
Marty Plummer d5fd27
+                else:
Marty Plummer d5fd27
+                    result += ("    %sok: field \"%s\" in %s:\n\t%sbefore: %s, after: %s\n"
Marty Plummer d5fd27
+                        % (indent, str(field_name), str(type_obj),
Marty Plummer d5fd27
+                           indent, str(align_before), str(align_after)))
Marty Plummer d5fd27
                 if self.verbosity >= 1:
Marty Plummer d5fd27
-		    result += self.callstack_to_str(indent, callstack)
Marty Plummer d5fd27
+                    result += self.callstack_to_str(indent, callstack)
Marty Plummer d5fd27
 
Marty Plummer d5fd27
-	# output the fail-list
Marty Plummer d5fd27
-	for (align_before, field_name, type_obj, callstack, reason) in self.fail_list:
Marty Plummer d5fd27
-	    stacksize = len(callstack)
Marty Plummer d5fd27
+        # output the fail-list
Marty Plummer d5fd27
+        for (align_before, field_name, type_obj, callstack, reason) in self.fail_list:
Marty Plummer d5fd27
+            stacksize = len(callstack)
Marty Plummer d5fd27
             indent = '  ' * stacksize
Marty Plummer d5fd27
-	    if field_name is None or field_name == "":
Marty Plummer d5fd27
-	        result += ("    %sfail: align %s is incompatible with\n\t%s%s\n\t%sReason: %s\n"
Marty Plummer d5fd27
-		    % (indent, str(align_before), indent, str(type_obj), indent, reason))
Marty Plummer d5fd27
-	    else:
Marty Plummer d5fd27
-		result += ("    %sfail: align %s is incompatible with\n\t%sfield \"%s\" in %s\n\t%sReason: %s\n"
Marty Plummer d5fd27
-		    % (indent, str(align_before), indent, str(field_name), str(type_obj), indent, reason))
Marty Plummer d5fd27
+            if field_name is None or field_name == "":
Marty Plummer d5fd27
+                result += ("    %sfail: align %s is incompatible with\n\t%s%s\n\t%sReason: %s\n"
Marty Plummer d5fd27
+                    % (indent, str(align_before), indent, str(type_obj), indent, reason))
Marty Plummer d5fd27
+            else:
Marty Plummer d5fd27
+                result += ("    %sfail: align %s is incompatible with\n\t%sfield \"%s\" in %s\n\t%sReason: %s\n"
Marty Plummer d5fd27
+                    % (indent, str(align_before), indent, str(field_name), str(type_obj), indent, reason))
Marty Plummer d5fd27
 
Marty Plummer d5fd27
             if self.verbosity >= 1:
Marty Plummer d5fd27
-	        result += self.callstack_to_str(indent, callstack)
Marty Plummer d5fd27
+                result += self.callstack_to_str(indent, callstack)
Marty Plummer d5fd27
 
Marty Plummer d5fd27
 
Marty Plummer d5fd27
-	return result
Marty Plummer d5fd27
+        return result
Marty Plummer d5fd27
 
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def callstack_to_str(self, indent, callstack):
Marty Plummer d5fd27
@@ -137,41 +137,41 @@ class AlignmentLog(object):
Marty Plummer d5fd27
         for stack_elem in callstack:
Marty Plummer d5fd27
             result += "\t  %s%s\n" % (indent, str(stack_elem))
Marty Plummer d5fd27
         result += "\t%s]\n" % indent
Marty Plummer d5fd27
-	return result
Marty Plummer d5fd27
+        return result
Marty Plummer d5fd27
 
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def ok_callstack_is_relevant(self, ok_callstack):
Marty Plummer d5fd27
         # determine whether an ok callstack is relevant for logging
Marty Plummer d5fd27
-	if self.verbosity >= 2:
Marty Plummer d5fd27
-	    return True
Marty Plummer d5fd27
+        if self.verbosity >= 2:
Marty Plummer d5fd27
+            return True
Marty Plummer d5fd27
 
Marty Plummer d5fd27
         # empty callstacks are always relevant
Marty Plummer d5fd27
-	if len(ok_callstack) == 0:
Marty Plummer d5fd27
+        if len(ok_callstack) == 0:
Marty Plummer d5fd27
             return True
Marty Plummer d5fd27
 
Marty Plummer d5fd27
-	# check whether the ok_callstack is a subset or equal to a fail_callstack
Marty Plummer d5fd27
+        # check whether the ok_callstack is a subset or equal to a fail_callstack
Marty Plummer d5fd27
         for (align_before, field_name, type_obj, fail_callstack, reason) in self.fail_list:
Marty Plummer d5fd27
             if len(ok_callstack) <= len(fail_callstack):
Marty Plummer d5fd27
                 zipped = zip(ok_callstack, fail_callstack[:len(ok_callstack)])
Marty Plummer d5fd27
-		is_subset = all([i == j for i, j in zipped])
Marty Plummer d5fd27
-		if is_subset:
Marty Plummer d5fd27
+                is_subset = all([i == j for i, j in zipped])
Marty Plummer d5fd27
+                if is_subset:
Marty Plummer d5fd27
                     return True
Marty Plummer d5fd27
 
Marty Plummer d5fd27
         return False
Marty Plummer d5fd27
 
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def ok(self, align_before, field_name, type_obj, callstack, align_after):
Marty Plummer d5fd27
-	self.ok_list.append((align_before, field_name, type_obj, callstack, align_after))
Marty Plummer d5fd27
+        self.ok_list.append((align_before, field_name, type_obj, callstack, align_after))
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def fail(self, align_before, field_name, type_obj, callstack, reason):
Marty Plummer d5fd27
-	self.fail_list.append((align_before, field_name, type_obj, callstack, reason))
Marty Plummer d5fd27
+        self.fail_list.append((align_before, field_name, type_obj, callstack, reason))
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def append(self, other):
Marty Plummer d5fd27
-	self.ok_list.extend(other.ok_list)
Marty Plummer d5fd27
-	self.fail_list.extend(other.fail_list)
Marty Plummer d5fd27
+        self.ok_list.extend(other.ok_list)
Marty Plummer d5fd27
+        self.fail_list.extend(other.fail_list)
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def ok_count(self):
Marty Plummer d5fd27
-	return len(self.ok_list)
Marty Plummer d5fd27
+        return len(self.ok_list)
Marty Plummer d5fd27
 
Marty Plummer d5fd27
 
Marty Plummer d5fd27
 
Marty Plummer d5fd27
-- 
Marty Plummer d5fd27
cgit v0.10.2
Marty Plummer d5fd27
Marty Plummer d5fd27
From bea5e1c85bdc0950913790364e18228f20395a3d Mon Sep 17 00:00:00 2001
Marty Plummer d5fd27
From: Thomas Klausner <wiz@NetBSD.org>
Marty Plummer d5fd27
Date: Thu, 19 May 2016 17:30:05 +0200
Marty Plummer d5fd27
Subject: print() is a function and needs parentheses.
Marty Plummer d5fd27
Marty Plummer d5fd27
Fixes build with python-3.x.
Marty Plummer d5fd27
Marty Plummer d5fd27
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
Marty Plummer d5fd27
Signed-off-by: Uli Schlachter <psychon@znc.in>
Marty Plummer d5fd27
Marty Plummer d5fd27
diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
Marty Plummer d5fd27
index c3b5758..b83b119 100644
Marty Plummer d5fd27
--- a/xcbgen/xtypes.py
Marty Plummer d5fd27
+++ b/xcbgen/xtypes.py
Marty Plummer d5fd27
@@ -501,7 +501,7 @@ class ComplexType(Type):
Marty Plummer d5fd27
                 int(required_start_align_element.get('align', "4"), 0),
Marty Plummer d5fd27
                 int(required_start_align_element.get('offset', "0"), 0))
Marty Plummer d5fd27
             if verbose_align_log:
Marty Plummer d5fd27
-                print "Explicit start-align for %s: %s\n" % (self, self.required_start_align)
Marty Plummer d5fd27
+                print ("Explicit start-align for %s: %s\n" % (self, self.required_start_align))
Marty Plummer d5fd27
 
Marty Plummer d5fd27
     def resolve(self, module):
Marty Plummer d5fd27
         if self.resolved:
Marty Plummer d5fd27
@@ -592,7 +592,7 @@ class ComplexType(Type):
Marty Plummer d5fd27
                 if verbose_align_log:
Marty Plummer d5fd27
                     print ("calc_required_start_align: %s has start-align %s"
Marty Plummer d5fd27
                         % (str(self), str(self.required_start_align)))
Marty Plummer d5fd27
-                    print "Details:\n" + str(log)
Marty Plummer d5fd27
+                    print ("Details:\n" + str(log))
Marty Plummer d5fd27
                 if self.required_start_align.offset != 0:
Marty Plummer d5fd27
                     print (("WARNING: %s\n\thas start-align with non-zero offset: %s"
Marty Plummer d5fd27
                         + "\n\tsuggest to add explicit definition with:"
Marty Plummer d5fd27
@@ -619,12 +619,12 @@ class ComplexType(Type):
Marty Plummer d5fd27
             for offset in range(0,align):
Marty Plummer d5fd27
                 align_candidate = Alignment(align, offset)
Marty Plummer d5fd27
                 if verbose_align_log:
Marty Plummer d5fd27
-                    print "trying %s for %s" % (str(align_candidate), str(self))
Marty Plummer d5fd27
+                    print ("trying %s for %s" % (str(align_candidate), str(self)))
Marty Plummer d5fd27
                 my_log = AlignmentLog()
Marty Plummer d5fd27
                 if self.is_possible_start_align(align_candidate, callstack, my_log):
Marty Plummer d5fd27
                     log.append(my_log)
Marty Plummer d5fd27
                     if verbose_align_log:
Marty Plummer d5fd27
-                        print "found start-align %s for %s" % (str(align_candidate), str(self))
Marty Plummer d5fd27
+                        print ("found start-align %s for %s" % (str(align_candidate), str(self)))
Marty Plummer d5fd27
                     return align_candidate
Marty Plummer d5fd27
                 else:
Marty Plummer d5fd27
                     my_ok_count = my_log.ok_count()
Marty Plummer d5fd27
@@ -641,7 +641,7 @@ class ComplexType(Type):
Marty Plummer d5fd27
         # none of the candidates applies
Marty Plummer d5fd27
         # this type has illegal internal aligns for all possible start_aligns
Marty Plummer d5fd27
         if verbose_align_log:
Marty Plummer d5fd27
-            print "didn't find start-align for %s" % str(self)
Marty Plummer d5fd27
+            print ("didn't find start-align for %s" % str(self))
Marty Plummer d5fd27
         log.append(best_log)
Marty Plummer d5fd27
         return None
Marty Plummer d5fd27
 
Marty Plummer d5fd27
@@ -900,7 +900,7 @@ class SwitchType(ComplexType):
Marty Plummer d5fd27
     # aux function for unchecked_get_alignment_after
Marty Plummer d5fd27
     def get_align_for_selected_case_field(self, case_field, start_align, callstack, log):
Marty Plummer d5fd27
         if verbose_align_log:
Marty Plummer d5fd27
-            print "get_align_for_selected_case_field: %s, case_field = %s" % (str(self), str(case_field))
Marty Plummer d5fd27
+            print ("get_align_for_selected_case_field: %s, case_field = %s" % (str(self), str(case_field)))
Marty Plummer d5fd27
         total_align = start_align
Marty Plummer d5fd27
         for field in self.bitcases:
Marty Plummer d5fd27
             my_callstack = callstack[:]
Marty Plummer d5fd27
-- 
Marty Plummer d5fd27
cgit v0.10.2
Marty Plummer d5fd27