pkgsrc/x11/py-xcbgen/patches/patch-ab
drochner d77711cf97 split the "xcbgen" Python extension which comes with xcb-proto
into its own pkg and pull it in the common Python way so that
we ensure matching Python versions
2009-04-08 13:06:22 +00:00

42 lines
1.5 KiB
Text

$NetBSD: patch-ab,v 1.1 2009/04/08 13:06:22 drochner Exp $
--- xcbgen/xtypes.py.orig 2008-09-05 00:49:13.000000000 +0200
+++ xcbgen/xtypes.py
@@ -160,12 +160,22 @@ class ListType(Type):
if elt.tag == 'list':
elts = list(elt)
- self.expr = Expression(elts[0] if len(elts) else elt, self)
+ if len(elts):
+ self.expr = Expression(elts[0], self)
+ else:
+ self.expr = Expression(elt, self)
elif elt.tag == 'valueparam':
self.expr = Expression(elt, self)
- self.size = member.size if member.fixed_size() else None
- self.nmemb = self.expr.nmemb if self.expr.fixed_size() else None
+ if member.fixed_size():
+ self.size = member.size
+ else:
+ self.size = None
+
+ if self.expr.fixed_size():
+ self.nmemb = self.expr.nmemb
+ else:
+ self.nmemb = None
def make_member_of(self, module, complex_type, field_type, field_name, visible, wire, auto):
if not self.fixed_size():
@@ -256,7 +266,10 @@ class PadType(SizedPadType):
Derived class which represents a padding field of given type.
'''
def __init__(self, elt):
- self.nmemb = "1" if (elt == None) else elt.get('bytes')
+ if (elt == None):
+ self.nmemb = "1"
+ else:
+ self.nmemb = elt.get('bytes')
SizedPadType.__init__(self, self.nmemb)
class ComplexType(Type):