archrelease: copy trunk to community-any
[ArchLinux/community.git] / ming / repos / community-x86_64 / py3.patch
blobcbe166c3726c84f0165df5a80eb85824d434d33f
1 From d59080d266fae60b8c5b28fbcb1696d291d5e419 Mon Sep 17 00:00:00 2001
2 From: Connor Behan <connor.behan@gmail.com>
3 Date: Sat, 12 Sep 2020 03:05:02 +0100
4 Subject: [PATCH] Python 3
6 ---
7 ming.i | 5 +--
8 py_ext/ming.py | 92 +++++++++++++++++++++++++-------------------------
9 2 files changed, 49 insertions(+), 48 deletions(-)
11 diff --git a/ming.i b/ming.i
12 index 7ebcaa2d..314d15bc 100644
13 --- a/ming.i
14 +++ b/ming.i
15 @@ -12,11 +12,12 @@
18 %typemap(python,in) FILE * {
19 - if (!PyFile_Check($input)) {
20 + int temp = PyObject_AsFileDescriptor($input);
21 + if (temp == -1) {
22 PyErr_SetString(PyExc_TypeError, "Need a file!");
23 return NULL;
25 - $1 = PyFile_AsFile($input);
26 + $1 = fdopen(temp, "r");
29 %typemap(python,in) char * {
30 diff --git a/py_ext/ming.py b/py_ext/ming.py
31 index 1e23649b..f993aa2f 100644
32 --- a/py_ext/ming.py
33 +++ b/py_ext/ming.py
34 @@ -112,57 +112,57 @@ class SWFFilter(SWFBase):
35 if type == SWFFILTER_TYPE_DROPSHADOW:
36 #color, blur, shadow, flags
37 if not isinstance(arg2, SWFBlur):
38 - raise AttributeError, "3. parameter has to be SWFBlur"
39 + raise AttributeError("3. parameter has to be SWFBlur")
40 if not isinstance(arg3, SWFShadow):
41 - raise AttributeError, "4. parameter has to be SWFShadow"
42 + raise AttributeError("4. parameter has to be SWFShadow")
43 self.this = mingc.newDropShadowFilter(arg1, arg2.this, arg3.this, arg4)
44 elif type == SWFFILTER_TYPE_BLUR:
45 #blur
46 if not isinstance(arg1, SWFBlur):
47 - raise AttributeError, "2. parameter has to be SWFBlur"
48 + raise AttributeError("2. parameter has to be SWFBlur")
49 self.this = mingc.newBlurFilter(arg1.this)
50 elif type == SWFFILTER_TYPE_GLOW:
51 #color, blur, strength, flags
52 if not isinstance(arg2, SWFBlur):
53 - raise AttributeError, "3. parameter has to be SWFBlur"
54 + raise AttributeError("3. parameter has to be SWFBlur")
55 self.this = mingc.newGlowFilter(arg1, arg2.this, arg3, arg4)
56 - elif type == SWFFILTER_TYPE_BEVEL:
57 + elif type == SWFFILTER_TYPE_BEVEL:
58 #shadowColor, highlightColor, blur, shadow, flags
59 if not isinstance(arg3, SWFBlur):
60 - raise AttributeError, "4. parameter has to be SWFBlur"
61 + raise AttributeError("4. parameter has to be SWFBlur")
62 if not isinstance(arg4, SWFShadow):
63 - raise AttributeError, "5. parameter has to be SWFShadow"
64 + raise AttributeError("5. parameter has to be SWFShadow")
65 self.this = mingc.newBevelFilte(arg1, arg2, arg3.this, arg4.this, arg5)
66 - elif type == SWFFILTER_TYPE_GRADIENTGLOW:
67 + elif type == SWFFILTER_TYPE_GRADIENTGLOW:
68 #gradient, blur, shadow, flags
69 if not isinstance(arg1, SWFGradient):
70 - raise AttributeError, "2. parameter has to be SWFGradient"
71 + raise AttributeError("2. parameter has to be SWFGradient")
72 if not isinstance(arg2, SWFBlur):
73 - raise AttributeError, "3. parameter has to be SWFBlur"
74 + raise AttributeError("3. parameter has to be SWFBlur")
75 if not isinstance(arg3, SWFShadow):
76 - raise AttributeError, "4. parameter has to be SWFShadow"
77 + raise AttributeError("4. parameter has to be SWFShadow")
78 self.this = mingc.newGradienGlowFilter(arg1.this, arg2.this, arg3.this, arg4)
79 elif type == SWFFILTER_TYPE_COLORMATRIX:
80 #colormatrix
81 if not isinstance(arg1, SWFFilterMatrix):
82 - raise AttributeError, "2. parameter has to be SWFFilterMatrix"
83 + raise AttributeError("2. parameter has to be SWFFilterMatrix")
84 self.this = mingc.newColorMatrixFilter(arg1.this)
85 - elif type == SWFFILTER_TYPE_CONVOLUTION:
86 + elif type == SWFFILTER_TYPE_CONVOLUTION:
87 #colormatrix, divisor, bias, color, flags
88 if not isinstance(arg1, SWFFilterMatrix):
89 - raise AttributeError, "2. parameter has to be SWFFilterMatrix"
90 + raise AttributeError("2. parameter has to be SWFFilterMatrix")
91 self.this = mingc.newConvolutionFilter(arg1.this, arg2, arg3, arg4, arg5)
92 elif type == SWFFILTER_TYPE_GRADIENTBEVEL:
93 #gradient, blur, shadow, flags
94 if not isinstance(arg1, SWFGradient):
95 - raise AttributeError, "2. parameter has to be SWFGradient"
96 + raise AttributeError("2. parameter has to be SWFGradient")
97 if not isinstance(arg2, SWFBlur):
98 - raise AttributeError, "3. parameter has to be SWFBlur"
99 + raise AttributeError("3. parameter has to be SWFBlur")
100 if not isinstance(arg3, SWFShadow):
101 - raise AttributeError, "4. parameter has to be SWFShadow"
102 + raise AttributeError("4. parameter has to be SWFShadow")
103 self.this = mingc.newGradientBevelFilter(arg1.this, arg2.this, arg3.this, arg4)
104 - else:
105 - raise AttributeError, "bad filter type to SWFFilter::new"
106 + else:
107 + raise AttributeError("bad filter type to SWFFilter::new")
109 class SWFMatrix(SWFBase):
111 @@ -230,7 +230,7 @@ class SWFShape(SWFBase):
112 return SWFFill(mingc.SWFShape_addBitmapFill(self.this, arg1.this, arg2))
114 else:
115 - raise AttributeError, "bad argument to SWFShape::addFill"
116 + raise AttributeError("bad argument to SWFShape::addFill")
118 def setLeftFill(self, fill):
119 mingc.SWFShape_setLeftFill(self.this, fill)
120 @@ -455,29 +455,29 @@ class SWFDisplayItem(SWFBase):
121 mingc.SWFDisplayItem_setMaskLevel(self.this, level)
123 def getPositionX(self):
124 - x = mingc.new_floatp()
125 - y = mingc.new_floatp()
126 - mingc.SWFDisplayItem_getPosition(self.this, x, y)
127 - ret = mingc.floatp_value(x)
128 - mingc.delete_floatp(x)
129 - mingc.delete_floatp(y)
130 - return ret
131 + x = mingc.new_floatp()
132 + y = mingc.new_floatp()
133 + mingc.SWFDisplayItem_getPosition(self.this, x, y)
134 + ret = mingc.floatp_value(x)
135 + mingc.delete_floatp(x)
136 + mingc.delete_floatp(y)
137 + return ret
139 def getPositionY(self):
140 - x = mingc.new_floatp()
141 - y = mingc.new_floatp()
142 - mingc.SWFDisplayItem_getPosition(self.this, x, y)
143 - ret = mingc.floatp_value(y)
144 - mingc.delete_floatp(x)
145 - mingc.delete_floatp(y)
146 - return ret
147 + x = mingc.new_floatp()
148 + y = mingc.new_floatp()
149 + mingc.SWFDisplayItem_getPosition(self.this, x, y)
150 + ret = mingc.floatp_value(y)
151 + mingc.delete_floatp(x)
152 + mingc.delete_floatp(y)
153 + return ret
155 def getRotation(self):
156 rot = mingc.new_floatp()
157 - mingc.SWFDisplayItem_getRotation(self.this, rot)
158 - ret = mingc.floatp_value(rot)
159 - mingc.delete_floatp(rot)
160 - return ret
161 + mingc.SWFDisplayItem_getRotation(self.this, rot)
162 + ret = mingc.floatp_value(rot)
163 + mingc.delete_floatp(rot)
164 + return ret
166 def getScaleX(self):
167 sx = mingc.new_floatp()
168 @@ -525,7 +525,7 @@ class SWFDisplayItem(SWFBase):
169 return SWFMatrix(mingc.SWFDisplayItem_getMatrix(self.this))
171 def setCXform(self, cx):
172 - mingc.SWFDisplayItem_setCXform(self.this, cx.this);
173 + mingc.SWFDisplayItem_setCXform(self.this, cx.this);
175 def addFilter(self, filter):
176 mingc.SWFDisplayItem_addFilter(self.this, filter.this)
177 @@ -644,7 +644,7 @@ class SWFMovie(SWFBase):
178 mingc.SWFMovie_writeExports(self.this)
180 def assignSymbol(self, character, name):
181 - mingc.SWFMovie_assignSymbol(self.this, character.this, name)
182 + mingc.SWFMovie_assignSymbol(self.this, character.this, name)
184 def setNetworkAccess(self, flag):
185 mingc.SWFMovie_setNetworkAccess(self.this, flag)
186 @@ -1205,12 +1205,12 @@ SWFVIDEOSTREAM_MODE_MANUAL = mingc.SWFVIDEOSTREAM_MODE_MANUAL
188 class SWFVideoStream(SWFBase):
189 def __init__(self, filename=None):
190 - if filename is None:
191 - self.file = 0;
192 - self.this = mingc.newSWFVideoStream()
193 - else:
194 - self.file = open(filename, "rb");
195 - self.this = mingc.newSWFVideoStream_fromFile(self.file)
196 + if filename is None:
197 + self.file = 0;
198 + self.this = mingc.newSWFVideoStream()
199 + else:
200 + self.file = open(filename, "rb");
201 + self.this = mingc.newSWFVideoStream_fromFile(self.file)
202 def setDimension(self, w, h):
203 return mingc.SWFVideoStream_setDimension(self.this, w, h)
204 def getNumFrames(self):
206 2.21.0