tych0/xcffib — pull request #7 by flacjacket (2014-06-25 21:34:53+00:00)
Title: More Python 3 fixes

Some more fixes for Python 3:

* Fixed up some issues with handling of bytes (Python 3 specific)

* Use integer division for `` tags (Python 3 specific). This may require adding `from __future__ import division` to the files that have the change for Python 2.6 support, though it should work fine in Python 2.7.

* Fixed parentheses when parsing `` tags

The changes induced by the last two on the generated files are:
```
diff xcffib-orig/dri2.py xcffib/dri2.py
63c63
< self.alignment_pad = xcffib.List(unpacker, "c", self.driver_name_length + 3 & ~ 3 - self.driver_name_length)
---
> self.alignment_pad = xcffib.List(unpacker, "c", ((self.driver_name_length + 3) & (~ 3)) - self.driver_name_length)
diff xcffib-orig/glx.py xcffib/glx.py
316c316
< self.data = xcffib.List(unpacker, "d", self.length / 2)
---
> self.data = xcffib.List(unpacker, "d", self.length // 2)
Common subdirectories: xcffib-orig/__pycache__ and xcffib/__pycache__
diff xcffib-orig/randr.py xcffib/randr.py
163c163
< self.data = xcffib.List(unpacker, "B", self.num_items * self.format / 8)
---
> self.data = xcffib.List(unpacker, "B", self.num_items * (self.format // 8))
317c317
< self.data = xcffib.List(unpacker, "c", self.num_items * self.format / 8)
---
> self.data = xcffib.List(unpacker, "c", self.num_items * (self.format // 8))
diff xcffib-orig/xf86vidmode.py xcffib/xf86vidmode.py
63c63
< self.alignment_pad = xcffib.List(unpacker, "c", self.vendor_length + 3 & ~ 3 - self.vendor_length)
---
> self.alignment_pad = xcffib.List(unpacker, "c", ((self.vendor_length + 3) & (~ 3)) - self.vendor_length)
98c98
< self.clock = xcffib.List(unpacker, "I", 1 - self.flags & 1 * self.clocks)
---
> self.clock = xcffib.List(unpacker, "I", (1 - (self.flags & 1)) * self.clocks)
115,117c115,117
< self.red = xcffib.List(unpacker, "H", self.size + 1 & ~ 1)
< self.green = xcffib.List(unpacker, "H", self.size + 1 & ~ 1)
< self.blue = xcffib.List(unpacker, "H", self.size + 1 & ~ 1)
---
> self.red = xcffib.List(unpacker, "H", (self.size + 1) & (~ 1))
> self.green = xcffib.List(unpacker, "H", (self.size + 1) & (~ 1))
> self.blue = xcffib.List(unpacker, "H", (self.size + 1) & (~ 1))
diff xcffib-orig/xfixes.py xcffib/xfixes.py
71c71
< self.rectangles = xcffib.List(unpacker, xproto.RECTANGLE, self.length / 2)
---
> self.rectangles = xcffib.List(unpacker, xproto.RECTANGLE, self.length // 2)
diff xcffib-orig/xinput.py xcffib/xinput.py
774c774
< self.uninterpreted_data = xcffib.List(unpacker, "B", self.len * 4 - 4)
---
> self.uninterpreted_data = xcffib.List(unpacker, "B", (self.len * 4) - 4)
862c862
< self.state = xcffib.List(unpacker, "I", self.num_buttons + 31 / 32)
---
> self.state = xcffib.List(unpacker, "I", (self.num_buttons + 31) // 32)
926c926
< self.uninterpreted_data = xcffib.List(unpacker, "B", self.len * 4 - 8)
---
> self.uninterpreted_data = xcffib.List(unpacker, "B", (self.len * 4) - 8)
938c938
< self.name = xcffib.List(unpacker, "c", self.name_len + 3 / 4 * 4)
---
> self.name = xcffib.List(unpacker, "c", ((self.name_len + 3) // 4) * 4)
diff xcffib-orig/xproto.py xcffib/xproto.py
820c820
< self.value = xcffib.List(unpacker, "c", self.value_len * self.format / 8)
---
> self.value = xcffib.List(unpacker, "c", self.value_len * (self.format // 8))
```