Merge lp:~stgraber/ubuntu/quantal/newt/python3 into lp:ubuntu/quantal/newt
- Quantal (12.10)
- python3
- Merge into quantal
Proposed by
Stéphane Graber
Status: | Merged |
---|---|
Merged at revision: | 44 |
Proposed branch: | lp:~stgraber/ubuntu/quantal/newt/python3 |
Merge into: | lp:ubuntu/quantal/newt |
Diff against target: |
769 lines (+651/-14) 4 files modified
debian/changelog (+17/-0) debian/control (+29/-7) debian/patches/002_python3.patch (+529/-0) debian/rules (+76/-7) |
To merge this branch: | bzr merge lp:~stgraber/ubuntu/quantal/newt/python3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Steve Langasek | Needs Fixing | ||
Review via email: mp+110154@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 50. By Stéphane Graber
-
Fix Provides/Depends for python3 package
- 51. By Stéphane Graber
-
Fix typo s/built a text UI/build a text UI/g
- 52. By Stéphane Graber
-
No need to send .keys() through list() as it already returns something we can iterate
- 53. By Stéphane Graber
-
.keys() is iterable, no need to get it through list()
- 54. By Stéphane Graber
-
Remove non-idiomatic parentheses
- 55. By Stéphane Graber
-
Rebuild diff, drop import of types in snack.py (no longer used) and use isinstance() instead of direct type comparison
- 56. By Stéphane Graber
-
Re-introduce list() call around hotkeys.keys() as it's actually required with python3
- 57. By Stéphane Graber
-
Do the same str or basestring trick for the other isinstance() call
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2012-02-09 16:19:14 +0000 | |||
3 | +++ debian/changelog 2012-06-13 21:24:19 +0000 | |||
4 | @@ -1,3 +1,20 @@ | |||
5 | 1 | newt (0.52.11-2ubuntu11) UNRELEASED; urgency=low | ||
6 | 2 | |||
7 | 3 | [ James Hunt ] | ||
8 | 4 | * Port python module to python3: | ||
9 | 5 | - Introduces python3-newt and python3-newt-dbg. | ||
10 | 6 | - Update build-depend to require python3-all-dev. | ||
11 | 7 | |||
12 | 8 | [ Stéphane Graber ] | ||
13 | 9 | * Port python module to python3: | ||
14 | 10 | - Make a debian/patches patch out of James' changes. | ||
15 | 11 | - Add missing python3-all-dbg build-dependency. | ||
16 | 12 | - Fix debian/rules generated symlinks to work with the python3 | ||
17 | 13 | packages. | ||
18 | 14 | - Fix the Provides and Depends of the python3 packages. | ||
19 | 15 | |||
20 | 16 | -- Stéphane Graber <stgraber@ubuntu.com> Wed, 13 Jun 2012 15:53:48 -0400 | ||
21 | 17 | |||
22 | 1 | newt (0.52.11-2ubuntu10) precise; urgency=low | 18 | newt (0.52.11-2ubuntu10) precise; urgency=low |
23 | 2 | 19 | ||
24 | 3 | * Move libnewt to /lib and whiptail to /bin so they can be used by | 20 | * Move libnewt to /lib and whiptail to /bin so they can be used by |
25 | 4 | 21 | ||
26 | === modified file 'debian/control' | |||
27 | --- debian/control 2011-06-27 11:59:01 +0000 | |||
28 | +++ debian/control 2012-06-13 21:24:19 +0000 | |||
29 | @@ -6,7 +6,9 @@ | |||
30 | 6 | Standards-Version: 3.9.1 | 6 | Standards-Version: 3.9.1 |
31 | 7 | Homepage: https://fedorahosted.org/newt/ | 7 | Homepage: https://fedorahosted.org/newt/ |
32 | 8 | Vcs-Git: git://git.fedorahosted.org/git/newt | 8 | Vcs-Git: git://git.fedorahosted.org/git/newt |
34 | 9 | Build-Depends: dbs, sgmltools-lite, libslang2-dev (>=2.0.4-2), libpopt-dev, debhelper (>=5.0.37.2), gettext, libfribidi-dev, tcl8.5-dev, python-all-dev (>= 2.6.6-3~), autoconf, python-all-dbg | 9 | Build-Depends: dbs, sgmltools-lite, libslang2-dev (>=2.0.4-2), libpopt-dev, debhelper (>=5.0.37.2), gettext, libfribidi-dev, tcl8.5-dev, python-all-dev (>= 2.6.6-3~), python3-all-dev (>= 3.2.3), autoconf, python-all-dbg, python3-all-dbg |
35 | 10 | X-Python-Version: >= 2.6 | ||
36 | 11 | X-Python3-Version: >= 3.2 | ||
37 | 10 | 12 | ||
38 | 11 | Package: libnewt-dev | 13 | Package: libnewt-dev |
39 | 12 | Architecture: any | 14 | Architecture: any |
40 | @@ -48,7 +50,7 @@ | |||
41 | 48 | Provides: ${python:Provides} | 50 | Provides: ${python:Provides} |
42 | 49 | Depends: libnewt0.52 (=${binary:Version}) , ${python:Depends}, ${misc:Depends}, ${shlibs:Depends} | 51 | Depends: libnewt0.52 (=${binary:Version}) , ${python:Depends}, ${misc:Depends}, ${shlibs:Depends} |
43 | 50 | Description: A NEWT module for Python | 52 | Description: A NEWT module for Python |
45 | 51 | This module allows you to built a text UI for your Python scripts | 53 | This module allows you to build a text UI for your Python scripts |
46 | 52 | using newt. | 54 | using newt. |
47 | 53 | 55 | ||
48 | 54 | Package: python-newt-dbg | 56 | Package: python-newt-dbg |
49 | @@ -57,11 +59,31 @@ | |||
50 | 57 | Priority: extra | 59 | Priority: extra |
51 | 58 | Depends: libnewt0.52 (=${binary:Version}), python-newt (=${binary:Version}), python-dbg, ${misc:Depends}, ${shlibs:Depends} | 60 | Depends: libnewt0.52 (=${binary:Version}), python-newt (=${binary:Version}), python-dbg, ${misc:Depends}, ${shlibs:Depends} |
52 | 59 | Description: A NEWT module for Python (debug extension) | 61 | Description: A NEWT module for Python (debug extension) |
58 | 60 | This module allows you to built a text UI for your Python scripts | 62 | This module allows you to build a text UI for your Python scripts |
59 | 61 | using newt. | 63 | using newt. |
60 | 62 | . | 64 | . |
61 | 63 | This package contains the extension built for the Python debug interpreter. | 65 | This package contains the extension built for the Python debug interpreter. |
62 | 64 | 66 | ||
63 | 67 | Package: python3-newt | ||
64 | 68 | Architecture: any | ||
65 | 69 | Section: python | ||
66 | 70 | Priority: optional | ||
67 | 71 | Provides: ${python3:Provides} | ||
68 | 72 | Depends: libnewt0.52 (=${binary:Version}) , ${python3:Depends}, ${misc:Depends}, ${shlibs:Depends} | ||
69 | 73 | Description: A NEWT module for Python 3 | ||
70 | 74 | This module allows you to build a text UI for your Python 3 scripts | ||
71 | 75 | using newt. | ||
72 | 76 | |||
73 | 77 | Package: python3-newt-dbg | ||
74 | 78 | Architecture: any | ||
75 | 79 | Section: debug | ||
76 | 80 | Priority: extra | ||
77 | 81 | Depends: libnewt0.52 (=${binary:Version}), python3-newt (=${binary:Version}), python3-dbg, ${misc:Depends}, ${shlibs:Depends} | ||
78 | 82 | Description: A NEWT module for Python 3 (debug extension) | ||
79 | 83 | This module allows you to build a text UI for your Python 3 scripts | ||
80 | 84 | using newt. | ||
81 | 85 | . | ||
82 | 86 | This package contains the extension built for the Python debug interpreter. | ||
83 | 65 | 87 | ||
84 | 66 | Package: libnewt0.52 | 88 | Package: libnewt0.52 |
85 | 67 | Architecture: any | 89 | Architecture: any |
86 | 68 | 90 | ||
87 | === added file 'debian/patches/002_python3.patch' | |||
88 | --- debian/patches/002_python3.patch 1970-01-01 00:00:00 +0000 | |||
89 | +++ debian/patches/002_python3.patch 2012-06-13 21:24:19 +0000 | |||
90 | @@ -0,0 +1,529 @@ | |||
91 | 1 | diff -Nrup newt-0.52.11.orig/Makefile.in newt-0.52.11/Makefile.in | ||
92 | 2 | --- newt-0.52.11.orig/Makefile.in 2012-06-13 15:27:07.475835745 -0400 | ||
93 | 3 | +++ newt-0.52.11/Makefile.in 2012-06-13 16:48:33.031972016 -0400 | ||
94 | 4 | @@ -12,6 +12,7 @@ TAG = r$(subst .,-,$(VERSION)) | ||
95 | 5 | SONAME = @SONAME@ | ||
96 | 6 | |||
97 | 7 | PYTHONVERS = $(shell pyversions --supported) | ||
98 | 8 | +PYTHON3VERS = $(shell py3versions --supported) | ||
99 | 9 | WHIPTCLSO = @WHIPTCLSO@ | ||
100 | 10 | |||
101 | 11 | PROGS = test whiptail $(WHIPTCLSO) testgrid testtree showchars showkey | ||
102 | 12 | @@ -68,7 +69,7 @@ showkey: showkey.o $(LIBNEWT) | ||
103 | 13 | $(CC) -g -o showkey showkey.o $(LIBNEWT) $(LIBS) | ||
104 | 14 | |||
105 | 15 | _snackmodule.so: snackmodule.c $(LIBNEWTSH) | ||
106 | 16 | - for ver in $(PYTHONVERS) ; do \ | ||
107 | 17 | + for ver in $(PYTHONVERS) $(PYTHON3VERS); do \ | ||
108 | 18 | mkdir -p $$ver ;\ | ||
109 | 19 | $(CC) $(CFLAGS) -I/usr/include/$$ver $(SHCFLAGS) -c -o $$ver/snackmodule.o snackmodule.c ;\ | ||
110 | 20 | $(CC) --shared $(SHCFLAGS) -o $$ver/_snackmodule.so $$ver/snackmodule.o -L . -lnewt ;\ | ||
111 | 21 | @@ -129,7 +130,7 @@ install-sh: sharedlib $(WHIPTCLSO) _snac | ||
112 | 22 | ln -sf $(LIBNEWTSONAME) $(instroot)/$(libdir)/libnewt.so | ||
113 | 23 | ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/$(LIBNEWTSONAME) | ||
114 | 24 | [ -n "$(WHIPTCLSO)" ] && install -m 755 whiptcl.so $(instroot)/$(libdir) || : | ||
115 | 25 | - for ver in $(PYTHONVERS) ; do \ | ||
116 | 26 | + for ver in $(PYTHONVERS) $(PYTHON3VERS); do \ | ||
117 | 27 | [ -d $(instroot)/$(libdir)/$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/$$ver/site-packages ;\ | ||
118 | 28 | install -m 755 $$ver/_snackmodule.so $(instroot)/$(libdir)/$$ver/site-packages ;\ | ||
119 | 29 | + install -m 755 $$ver/_snackmodule_d.so $(instroot)/$(libdir)/$$ver/site-packages ;\ | ||
120 | 30 | diff -Nrup newt-0.52.11.orig/peanuts.py newt-0.52.11/peanuts.py | ||
121 | 31 | --- newt-0.52.11.orig/peanuts.py 2009-09-24 11:03:09.000000000 -0400 | ||
122 | 32 | +++ newt-0.52.11/peanuts.py 2012-06-13 16:48:33.031972016 -0400 | ||
123 | 33 | @@ -2,6 +2,7 @@ | ||
124 | 34 | |||
125 | 35 | # Demo program to show use of python-newt module | ||
126 | 36 | |||
127 | 37 | +from __future__ import absolute_import, print_function, unicode_literals | ||
128 | 38 | from snack import * | ||
129 | 39 | |||
130 | 40 | screen = SnackScreen() | ||
131 | 41 | @@ -38,8 +39,8 @@ result = g.runOnce() | ||
132 | 42 | |||
133 | 43 | screen.finish() | ||
134 | 44 | |||
135 | 45 | -print result | ||
136 | 46 | -print "listbox:", li.current() | ||
137 | 47 | -print "rb:", rb.getSelection() | ||
138 | 48 | -print "bb:", bb.buttonPressed(result) | ||
139 | 49 | -print "checkboxtree:", ct.getSelection() | ||
140 | 50 | +print(result) | ||
141 | 51 | +print("listbox:", li.current()) | ||
142 | 52 | +print("rb:", rb.getSelection()) | ||
143 | 53 | +print("bb:", bb.buttonPressed(result)) | ||
144 | 54 | +print("checkboxtree:", ct.getSelection()) | ||
145 | 55 | diff -Nrup newt-0.52.11.orig/popcorn.py newt-0.52.11/popcorn.py | ||
146 | 56 | --- newt-0.52.11.orig/popcorn.py 2009-09-24 11:03:09.000000000 -0400 | ||
147 | 57 | +++ newt-0.52.11/popcorn.py 2012-06-13 16:48:33.031972016 -0400 | ||
148 | 58 | @@ -1,5 +1,6 @@ | ||
149 | 59 | #!/usr/bin/python | ||
150 | 60 | |||
151 | 61 | +from __future__ import absolute_import, print_function, unicode_literals | ||
152 | 62 | from snack import * | ||
153 | 63 | import sys | ||
154 | 64 | |||
155 | 65 | @@ -45,7 +46,7 @@ r1 = SingleRadioButton("Radio 1", None, | ||
156 | 66 | r2 = SingleRadioButton("Radio 2", r1) | ||
157 | 67 | |||
158 | 68 | def something(): | ||
159 | 69 | - print hello | ||
160 | 70 | + print(hello) | ||
161 | 71 | |||
162 | 72 | screen = SnackScreen() | ||
163 | 73 | |||
164 | 74 | @@ -99,14 +100,14 @@ g.runOnce() | ||
165 | 75 | |||
166 | 76 | screen.finish() | ||
167 | 77 | |||
168 | 78 | -print "val", e.value() | ||
169 | 79 | -print "check", cb.value() | ||
170 | 80 | -print "r1", r1.selected() | ||
171 | 81 | -print "listbox", li.current() | ||
172 | 82 | +print("val", e.value()) | ||
173 | 83 | +print("check", cb.value()) | ||
174 | 84 | +print("r1", r1.selected()) | ||
175 | 85 | +print("listbox", li.current()) | ||
176 | 86 | # returns a tuple of the wrapped text, the actual width, and the actual height | ||
177 | 87 | -print res | ||
178 | 88 | +print(res) | ||
179 | 89 | |||
180 | 90 | -print foo | ||
181 | 91 | -print 'lbcw', lbcw | ||
182 | 92 | -print "ct selected", ct.getSelection() | ||
183 | 93 | -print "ct current", ct.getCurrent() | ||
184 | 94 | +print(foo) | ||
185 | 95 | +print('lbcw', lbcw) | ||
186 | 96 | +print("ct selected", ct.getSelection()) | ||
187 | 97 | +print("ct current", ct.getCurrent()) | ||
188 | 98 | diff -Nrup newt-0.52.11.orig/snackmodule.c newt-0.52.11/snackmodule.c | ||
189 | 99 | --- newt-0.52.11.orig/snackmodule.c 2012-06-13 15:27:07.479835744 -0400 | ||
190 | 100 | +++ newt-0.52.11/snackmodule.c 2012-06-13 16:48:33.031972016 -0400 | ||
191 | 101 | @@ -12,10 +12,24 @@ | ||
192 | 102 | #include <unistd.h> | ||
193 | 103 | |||
194 | 104 | #include "Python.h" | ||
195 | 105 | +#include "structmember.h" | ||
196 | 106 | #include "nls.h" | ||
197 | 107 | #include "newt.h" | ||
198 | 108 | #include "newt_pr.h" | ||
199 | 109 | |||
200 | 110 | +#if PY_MAJOR_VERSION >= 3 | ||
201 | 111 | + #define PyInt_FromLong PyLong_FromLong | ||
202 | 112 | + #define PyInt_AsLong PyLong_AsLong | ||
203 | 113 | + #define PyString_FromString PyUnicode_FromString | ||
204 | 114 | + #define MOD_ERROR_VAL NULL | ||
205 | 115 | + #define MOD_SUCCESS_VAL(val) val | ||
206 | 116 | + #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) | ||
207 | 117 | +#else | ||
208 | 118 | + #define MOD_ERROR_VAL | ||
209 | 119 | + #define MOD_SUCCESS_VAL(val) | ||
210 | 120 | + #define MOD_INIT(name) void init##name(void) | ||
211 | 121 | +#endif | ||
212 | 122 | + | ||
213 | 123 | typedef struct snackWidget_s snackWidget; | ||
214 | 124 | typedef struct snackGrid_s snackGrid; | ||
215 | 125 | typedef struct snackForm_s snackForm; | ||
216 | 126 | @@ -68,6 +82,8 @@ static snackWidget * textWidget(PyObject | ||
217 | 127 | static PyObject * ternaryWindow(PyObject * s, PyObject * args); | ||
218 | 128 | static snackWidget * checkboxTreeWidget(PyObject * s, PyObject * args, PyObject * kwargs); | ||
219 | 129 | static PyObject * pywstrlen(PyObject * s, PyObject * args); | ||
220 | 130 | +static PyObject * widget_get_checkboxValue(PyObject *self, void *closure); | ||
221 | 131 | +static PyObject * widget_get_radioValue(PyObject *self, void *closure); | ||
222 | 132 | |||
223 | 133 | static PyMethodDef snackModuleMethods[] = { | ||
224 | 134 | { "button", (PyCFunction) buttonWidget, METH_VARARGS, NULL }, | ||
225 | 135 | @@ -107,12 +123,31 @@ static PyMethodDef snackModuleMethods[] | ||
226 | 136 | { NULL } | ||
227 | 137 | } ; | ||
228 | 138 | |||
229 | 139 | +#if PY_MAJOR_VERSION >= 3 | ||
230 | 140 | +static struct PyModuleDef moduledef = { | ||
231 | 141 | + PyModuleDef_HEAD_INIT, | ||
232 | 142 | + "_snack", /* m_name */ | ||
233 | 143 | + NULL, /* m_doc */ | ||
234 | 144 | + -1, /* m_size */ | ||
235 | 145 | + snackModuleMethods, /* m_methods */ | ||
236 | 146 | + NULL, /* m_reload */ | ||
237 | 147 | + NULL, /* m_traverse */ | ||
238 | 148 | + NULL, /* m_clear */ | ||
239 | 149 | + NULL, /* m_free */ | ||
240 | 150 | + }; | ||
241 | 151 | +#endif | ||
242 | 152 | + | ||
243 | 153 | +static struct PyGetSetDef widget_getset[] = { | ||
244 | 154 | + { "checkboxValue", widget_get_checkboxValue, 0, NULL, NULL }, | ||
245 | 155 | + { "radioValue", widget_get_radioValue, 0, NULL, NULL }, | ||
246 | 156 | + { NULL } | ||
247 | 157 | +}; | ||
248 | 158 | + | ||
249 | 159 | struct snackGrid_s { | ||
250 | 160 | PyObject_HEAD | ||
251 | 161 | newtGrid grid; | ||
252 | 162 | } ; | ||
253 | 163 | |||
254 | 164 | -static PyObject * gridGetAttr(PyObject * s, char * name); | ||
255 | 165 | static PyObject * gridPlace(snackGrid * s, PyObject * args); | ||
256 | 166 | static PyObject * gridSetField(snackGrid * s, PyObject * args); | ||
257 | 167 | |||
258 | 168 | @@ -123,20 +158,34 @@ static PyMethodDef gridMethods[] = { | ||
259 | 169 | }; | ||
260 | 170 | |||
261 | 171 | static PyTypeObject snackGridType = { | ||
262 | 172 | - PyObject_HEAD_INIT(&PyType_Type) | ||
263 | 173 | - 0, /* ob_size */ | ||
264 | 174 | + PyVarObject_HEAD_INIT(&PyType_Type, 0) | ||
265 | 175 | "snackgrid", /* tp_name */ | ||
266 | 176 | sizeof(snackGrid), /* tp_size */ | ||
267 | 177 | 0, /* tp_itemsize */ | ||
268 | 178 | emptyDestructor, /* tp_dealloc */ | ||
269 | 179 | 0, /* tp_print */ | ||
270 | 180 | - gridGetAttr, /* tp_getattr */ | ||
271 | 181 | + 0, /* tp_getattr */ | ||
272 | 182 | 0, /* tp_setattr */ | ||
273 | 183 | 0, /* tp_compare */ | ||
274 | 184 | 0, /* tp_repr */ | ||
275 | 185 | 0, /* tp_as_number */ | ||
276 | 186 | 0, /* tp_as_sequence */ | ||
277 | 187 | 0, /* tp_as_mapping */ | ||
278 | 188 | + 0, /* tp_hash */ | ||
279 | 189 | + 0, /* tp_call */ | ||
280 | 190 | + 0, /* tp_str */ | ||
281 | 191 | + PyObject_GenericGetAttr, /* tp_getattro */ | ||
282 | 192 | + 0, /* tp_setattro */ | ||
283 | 193 | + 0, /* tp_as_buffer */ | ||
284 | 194 | + Py_TPFLAGS_DEFAULT, /* tp_flags */ | ||
285 | 195 | + 0, /* tp_doc */ | ||
286 | 196 | + 0, /* tp_traverse */ | ||
287 | 197 | + 0, /* tp_clear */ | ||
288 | 198 | + 0, /* tp_richcompare */ | ||
289 | 199 | + 0, /* tp_weaklistoffset */ | ||
290 | 200 | + 0, /* tp_iter */ | ||
291 | 201 | + 0, /* tp_iternext */ | ||
292 | 202 | + gridMethods /* tp_methods */ | ||
293 | 203 | }; | ||
294 | 204 | |||
295 | 205 | struct snackForm_s { | ||
296 | 206 | @@ -144,7 +193,6 @@ struct snackForm_s { | ||
297 | 207 | newtComponent fo; | ||
298 | 208 | } ; | ||
299 | 209 | |||
300 | 210 | -static PyObject * formGetAttr(PyObject * s, char * name); | ||
301 | 211 | static PyObject * formAdd(snackForm * s, PyObject * args); | ||
302 | 212 | static PyObject * formDraw(snackForm * s, PyObject * args); | ||
303 | 213 | static PyObject * formRun(snackForm * s, PyObject * args); | ||
304 | 214 | @@ -165,20 +213,34 @@ static PyMethodDef formMethods[] = { | ||
305 | 215 | }; | ||
306 | 216 | |||
307 | 217 | static PyTypeObject snackFormType = { | ||
308 | 218 | - PyObject_HEAD_INIT(&PyType_Type) | ||
309 | 219 | - 0, /* ob_size */ | ||
310 | 220 | + PyVarObject_HEAD_INIT(&PyType_Type, 0) | ||
311 | 221 | "snackform", /* tp_name */ | ||
312 | 222 | sizeof(snackForm), /* tp_size */ | ||
313 | 223 | 0, /* tp_itemsize */ | ||
314 | 224 | emptyDestructor, /* tp_dealloc */ | ||
315 | 225 | 0, /* tp_print */ | ||
316 | 226 | - formGetAttr, /* tp_getattr */ | ||
317 | 227 | + 0, /* tp_getattr */ | ||
318 | 228 | 0, /* tp_setattr */ | ||
319 | 229 | 0, /* tp_compare */ | ||
320 | 230 | 0, /* tp_repr */ | ||
321 | 231 | 0, /* tp_as_number */ | ||
322 | 232 | 0, /* tp_as_sequence */ | ||
323 | 233 | 0, /* tp_as_mapping */ | ||
324 | 234 | + 0, /* tp_hash */ | ||
325 | 235 | + 0, /* tp_call */ | ||
326 | 236 | + 0, /* tp_str */ | ||
327 | 237 | + PyObject_GenericGetAttr, /* tp_getattro */ | ||
328 | 238 | + 0, /* tp_setattro */ | ||
329 | 239 | + 0, /* tp_as_buffer */ | ||
330 | 240 | + Py_TPFLAGS_DEFAULT, /* tp_flags */ | ||
331 | 241 | + 0, /* tp_doc */ | ||
332 | 242 | + 0, /* tp_traverse */ | ||
333 | 243 | + 0, /* tp_clear */ | ||
334 | 244 | + 0, /* tp_richcompare */ | ||
335 | 245 | + 0, /* tp_weaklistoffset */ | ||
336 | 246 | + 0, /* tp_iter */ | ||
337 | 247 | + 0, /* tp_iternext */ | ||
338 | 248 | + formMethods /* tp_methods */ | ||
339 | 249 | }; | ||
340 | 250 | |||
341 | 251 | struct snackWidget_s { | ||
342 | 252 | @@ -191,7 +253,6 @@ struct snackWidget_s { | ||
343 | 253 | } ; | ||
344 | 254 | |||
345 | 255 | static PyObject * widgetAddCallback(snackWidget * s, PyObject * args); | ||
346 | 256 | -static PyObject * widgetGetAttr(PyObject * s, char * name); | ||
347 | 257 | static void widgetDestructor(PyObject * s); | ||
348 | 258 | static PyObject * widgetEntrySetValue(snackWidget * s, PyObject * args); | ||
349 | 259 | static PyObject * widgetLabelText(snackWidget * s, PyObject * args); | ||
350 | 260 | @@ -253,21 +314,43 @@ static PyMethodDef widgetMethods[] = { | ||
351 | 261 | { NULL } | ||
352 | 262 | }; | ||
353 | 263 | |||
354 | 264 | +static PyMemberDef widget_members[] = { | ||
355 | 265 | + { "key" , T_INT, offsetof(snackWidget, co), 0, NULL }, | ||
356 | 266 | + { "entryValue", T_STRING, offsetof(snackWidget, apointer), 0, NULL }, | ||
357 | 267 | + { NULL } | ||
358 | 268 | +}; | ||
359 | 269 | + | ||
360 | 270 | static PyTypeObject snackWidgetType = { | ||
361 | 271 | - PyObject_HEAD_INIT(&PyType_Type) | ||
362 | 272 | - 0, /* ob_size */ | ||
363 | 273 | + PyVarObject_HEAD_INIT(&PyType_Type, 0) | ||
364 | 274 | "snackwidget", /* tp_name */ | ||
365 | 275 | sizeof(snackWidget), /* tp_size */ | ||
366 | 276 | 0, /* tp_itemsize */ | ||
367 | 277 | widgetDestructor, /* tp_dealloc */ | ||
368 | 278 | 0, /* tp_print */ | ||
369 | 279 | - widgetGetAttr, /* tp_getattr */ | ||
370 | 280 | + 0, /* tp_getattr */ | ||
371 | 281 | 0, /* tp_setattr */ | ||
372 | 282 | 0, /* tp_compare */ | ||
373 | 283 | 0, /* tp_repr */ | ||
374 | 284 | 0, /* tp_as_number */ | ||
375 | 285 | 0, /* tp_as_sequence */ | ||
376 | 286 | 0, /* tp_as_mapping */ | ||
377 | 287 | + 0, /* tp_hash */ | ||
378 | 288 | + 0, /* tp_call */ | ||
379 | 289 | + 0, /* tp_str */ | ||
380 | 290 | + PyObject_GenericGetAttr, /* tp_getattro */ | ||
381 | 291 | + 0, /* tp_setattro */ | ||
382 | 292 | + 0, /* tp_as_buffer */ | ||
383 | 293 | + Py_TPFLAGS_DEFAULT, /* tp_flags */ | ||
384 | 294 | + 0, /* tp_doc */ | ||
385 | 295 | + 0, /* tp_traverse */ | ||
386 | 296 | + 0, /* tp_clear */ | ||
387 | 297 | + 0, /* tp_richcompare */ | ||
388 | 298 | + 0, /* tp_weaklistoffset */ | ||
389 | 299 | + 0, /* tp_iter */ | ||
390 | 300 | + 0, /* tp_iternext */ | ||
391 | 301 | + widgetMethods, /* tp_methods */ | ||
392 | 302 | + widget_members, /* tp_members */ | ||
393 | 303 | + widget_getset /* tp_getset */ | ||
394 | 304 | }; | ||
395 | 305 | |||
396 | 306 | static snackWidget * snackWidgetNew (void) { | ||
397 | 307 | @@ -808,10 +891,6 @@ static snackGrid * gridCreate(PyObject * | ||
398 | 308 | return grid; | ||
399 | 309 | } | ||
400 | 310 | |||
401 | 311 | -static PyObject * gridGetAttr(PyObject * s, char * name) { | ||
402 | 312 | - return Py_FindMethod(gridMethods, s, name); | ||
403 | 313 | -} | ||
404 | 314 | - | ||
405 | 315 | static PyObject * gridPlace(snackGrid * grid, PyObject * args) { | ||
406 | 316 | int x, y; | ||
407 | 317 | |||
408 | 318 | @@ -835,7 +914,7 @@ static PyObject * gridSetField(snackGrid | ||
409 | 319 | &anchorFlags, &growFlags)) | ||
410 | 320 | return NULL; | ||
411 | 321 | |||
412 | 322 | - if (w->ob_type == &snackWidgetType) { | ||
413 | 323 | + if (Py_TYPE(w) == &snackWidgetType) { | ||
414 | 324 | newtGridSetField(grid->grid, x, y, NEWT_GRID_COMPONENT, | ||
415 | 325 | w->co, pLeft, pTop, pRight, pBottom, anchorFlags, | ||
416 | 326 | growFlags); | ||
417 | 327 | @@ -850,10 +929,6 @@ static PyObject * gridSetField(snackGrid | ||
418 | 328 | return Py_None; | ||
419 | 329 | } | ||
420 | 330 | |||
421 | 331 | -static PyObject * formGetAttr(PyObject * s, char * name) { | ||
422 | 332 | - return Py_FindMethod(formMethods, s, name); | ||
423 | 333 | -} | ||
424 | 334 | - | ||
425 | 335 | static PyObject * formDraw(snackForm * s, PyObject * args) { | ||
426 | 336 | newtDrawForm(s->fo); | ||
427 | 337 | |||
428 | 338 | @@ -943,20 +1018,18 @@ static PyObject * formSetCurrent(snackFo | ||
429 | 339 | return Py_None; | ||
430 | 340 | } | ||
431 | 341 | |||
432 | 342 | -static PyObject * widgetGetAttr(PyObject * s, char * name) { | ||
433 | 343 | - snackWidget * w = (snackWidget *) s; | ||
434 | 344 | +static PyObject * widget_get_checkboxValue(PyObject *self, void *closure) | ||
435 | 345 | +{ | ||
436 | 346 | + snackWidget *w = (snackWidget *)self; | ||
437 | 347 | |||
438 | 348 | - if (!strcmp(name, "key")) { | ||
439 | 349 | - return Py_BuildValue("i", w->co); | ||
440 | 350 | - } else if (!strcmp(name, "entryValue")) { | ||
441 | 351 | - return Py_BuildValue("s", w->apointer); | ||
442 | 352 | - } else if (!strcmp(name, "checkboxValue")) { | ||
443 | 353 | return Py_BuildValue("i", w->achar == ' ' ? 0 : 1); | ||
444 | 354 | - } else if (!strcmp(name, "radioValue")) { | ||
445 | 355 | - return Py_BuildValue("i", newtRadioGetCurrent(w->co)); | ||
446 | 356 | - } | ||
447 | 357 | +} | ||
448 | 358 | + | ||
449 | 359 | +static PyObject * widget_get_radioValue(PyObject *self, void *closure) | ||
450 | 360 | +{ | ||
451 | 361 | + snackWidget *w = (snackWidget *)self; | ||
452 | 362 | |||
453 | 363 | - return Py_FindMethod(widgetMethods, s, name); | ||
454 | 364 | + return Py_BuildValue("i", newtRadioGetCurrent(w->co)); | ||
455 | 365 | } | ||
456 | 366 | |||
457 | 367 | static void widgetDestructor(PyObject * o) { | ||
458 | 368 | @@ -1284,7 +1357,8 @@ static PyObject * pywstrlen(PyObject * s | ||
459 | 369 | return PyInt_FromLong(wstrlen(str, len)); | ||
460 | 370 | } | ||
461 | 371 | |||
462 | 372 | -void init_snack(void) { | ||
463 | 373 | +MOD_INIT(_snack) | ||
464 | 374 | +{ | ||
465 | 375 | PyObject * d, * m; | ||
466 | 376 | |||
467 | 377 | #ifdef ENABLE_NLS | ||
468 | 378 | @@ -1293,7 +1367,15 @@ void init_snack(void) { | ||
469 | 379 | textdomain (PACKAGE); | ||
470 | 380 | #endif | ||
471 | 381 | |||
472 | 382 | +#if PY_MAJOR_VERSION >= 3 | ||
473 | 383 | + m = PyModule_Create(&moduledef); | ||
474 | 384 | +#else | ||
475 | 385 | m = Py_InitModule("_snack", snackModuleMethods); | ||
476 | 386 | +#endif | ||
477 | 387 | + | ||
478 | 388 | + if (! m) | ||
479 | 389 | + return MOD_ERROR_VAL; | ||
480 | 390 | + | ||
481 | 391 | d = PyModule_GetDict(m); | ||
482 | 392 | |||
483 | 393 | PyDict_SetItemString(d, "ANCHOR_LEFT", PyInt_FromLong(NEWT_ANCHOR_LEFT)); | ||
484 | 394 | @@ -1355,4 +1437,6 @@ void init_snack(void) { | ||
485 | 395 | PyDict_SetItemString(d, "COLORSET_COMPACTBUTTON", PyInt_FromLong(NEWT_COLORSET_COMPACTBUTTON)); | ||
486 | 396 | PyDict_SetItemString(d, "COLORSET_ACTSELLISTBOX", PyInt_FromLong(NEWT_COLORSET_ACTSELLISTBOX)); | ||
487 | 397 | PyDict_SetItemString(d, "COLORSET_SELLISTBOX", PyInt_FromLong(NEWT_COLORSET_SELLISTBOX)); | ||
488 | 398 | + | ||
489 | 399 | + return MOD_SUCCESS_VAL(m); | ||
490 | 400 | } | ||
491 | 401 | diff -Nrup newt-0.52.11.orig/snack.py newt-0.52.11/snack.py | ||
492 | 402 | --- newt-0.52.11.orig/snack.py 2009-09-24 11:03:09.000000000 -0400 | ||
493 | 403 | +++ newt-0.52.11/snack.py 2012-06-13 17:05:17.416000032 -0400 | ||
494 | 404 | @@ -39,9 +39,10 @@ Functions: | ||
495 | 405 | - EntryWindow | ||
496 | 406 | """ | ||
497 | 407 | |||
498 | 408 | + | ||
499 | 409 | +from __future__ import absolute_import, print_function, unicode_literals | ||
500 | 410 | import _snack | ||
501 | 411 | -import types | ||
502 | 412 | -import string | ||
503 | 413 | +import sys | ||
504 | 414 | |||
505 | 415 | from _snack import FLAG_DISABLED, FLAGS_SET, FLAGS_RESET, FLAGS_TOGGLE, FD_READ, FD_WRITE, FD_EXCEPT | ||
506 | 416 | |||
507 | 417 | @@ -296,7 +297,7 @@ hotkeys = { "F1" : _snack.KEY_F1, "F2" : | ||
508 | 418 | "F10" : _snack.KEY_F10, "F11" : _snack.KEY_F11, | ||
509 | 419 | "F12" : _snack.KEY_F12, "ESC" : _snack.KEY_ESC , " " : ord(" ") } | ||
510 | 420 | |||
511 | 421 | -for n in hotkeys.keys(): | ||
512 | 422 | +for n in list(hotkeys.keys()): | ||
513 | 423 | hotkeys[hotkeys[n]] = n | ||
514 | 424 | |||
515 | 425 | class Form: | ||
516 | 426 | @@ -317,14 +318,14 @@ class Form: | ||
517 | 427 | self.w.addhotkey(hotkeys[keyname]) | ||
518 | 428 | |||
519 | 429 | def add(self, widget): | ||
520 | 430 | - if widget.__dict__.has_key('hotkeys'): | ||
521 | 431 | + if 'hotkeys' in widget.__dict__: | ||
522 | 432 | for key in widget.hotkeys.keys(): | ||
523 | 433 | self.addHotKey(key) | ||
524 | 434 | |||
525 | 435 | - if widget.__dict__.has_key('gridmembers'): | ||
526 | 436 | + if 'gridmembers' in widget.__dict__: | ||
527 | 437 | for w in widget.gridmembers: | ||
528 | 438 | self.add(w) | ||
529 | 439 | - elif widget.__dict__.has_key('w'): | ||
530 | 440 | + elif 'w' in widget.__dict__: | ||
531 | 441 | self.trans[widget.w.key] = widget | ||
532 | 442 | return self.w.add(widget.w) | ||
533 | 443 | return None | ||
534 | 444 | @@ -397,14 +398,14 @@ class Grid: | ||
535 | 445 | if (growy): | ||
536 | 446 | gridFlags = gridFlags | _snack.GRID_GROWY | ||
537 | 447 | |||
538 | 448 | - if (what.__dict__.has_key('g')): | ||
539 | 449 | + if 'g' in what.__dict__: | ||
540 | 450 | return self.g.setfield(col, row, what.g, padding, anchorFlags, | ||
541 | 451 | gridFlags) | ||
542 | 452 | else: | ||
543 | 453 | return self.g.setfield(col, row, what.w, padding, anchorFlags) | ||
544 | 454 | |||
545 | 455 | def __init__(self, *args): | ||
546 | 456 | - self.g = apply(_snack.grid, args) | ||
547 | 457 | + self.g = _snack.grid(*args) | ||
548 | 458 | self.gridmembers = [] | ||
549 | 459 | |||
550 | 460 | colorsets = { "ROOT" : _snack.COLORSET_ROOT, | ||
551 | 461 | @@ -470,7 +471,7 @@ class SnackScreen: | ||
552 | 462 | |||
553 | 463 | def helpCallback(self, cb): | ||
554 | 464 | self.helpCb = cb | ||
555 | 465 | - return _snack.helpcallback(self.doHelpCallback) | ||
556 | 466 | + return _snack.helpcallback(self.doHelpCallback) | ||
557 | 467 | |||
558 | 468 | def suspendCallback(self, cb, data = None): | ||
559 | 469 | if data: | ||
560 | 470 | @@ -589,9 +590,9 @@ class ButtonBar(Grid): | ||
561 | 471 | self.item = 0 | ||
562 | 472 | Grid.__init__(self, len(buttonlist), 1) | ||
563 | 473 | for blist in buttonlist: | ||
564 | 474 | - if (type(blist) == types.StringType): | ||
565 | 475 | + if isinstance(blist, str if sys.version >= '3' else basestring): | ||
566 | 476 | title = blist | ||
567 | 477 | - value = string.lower(blist) | ||
568 | 478 | + value = blist.lower() | ||
569 | 479 | elif len(blist) == 2: | ||
570 | 480 | (title, value) = blist | ||
571 | 481 | else: | ||
572 | 482 | @@ -607,7 +608,7 @@ class ButtonBar(Grid): | ||
573 | 483 | self.item = self.item + 1 | ||
574 | 484 | |||
575 | 485 | def buttonPressed(self, result): | ||
576 | 486 | - if self.hotkeys.has_key(result): | ||
577 | 487 | + if result in self.hotkeys: | ||
578 | 488 | return self.hotkeys[result] | ||
579 | 489 | |||
580 | 490 | for (button, value) in self.list: | ||
581 | 491 | @@ -642,7 +643,7 @@ class GridFormHelp(Grid): | ||
582 | 492 | self.form_created = 0 | ||
583 | 493 | args = list(args) | ||
584 | 494 | args[:0] = [self] | ||
585 | 495 | - apply(Grid.__init__, tuple(args)) | ||
586 | 496 | + Grid.__init__(*tuple(args)) | ||
587 | 497 | |||
588 | 498 | def add(self, widget, col, row, padding = (0, 0, 0, 0), | ||
589 | 499 | anchorLeft = 0, anchorTop = 0, anchorRight = 0, | ||
590 | 500 | @@ -698,7 +699,7 @@ class GridForm(GridFormHelp): | ||
591 | 501 | """ | ||
592 | 502 | def __init__(self, screen, title, *args): | ||
593 | 503 | myargs = (self, screen, title, None) + args | ||
594 | 504 | - apply(GridFormHelp.__init__, myargs) | ||
595 | 505 | + GridFormHelp.__init__(*myargs) | ||
596 | 506 | |||
597 | 507 | class CheckboxTree(Widget): | ||
598 | 508 | """ CheckboxTree combo widget, | ||
599 | 509 | @@ -773,7 +774,7 @@ def ListboxChoiceWindow(screen, title, t | ||
600 | 510 | l = Listbox(height, scroll = scroll, returnExit = 1) | ||
601 | 511 | count = 0 | ||
602 | 512 | for item in items: | ||
603 | 513 | - if (type(item) == types.TupleType): | ||
604 | 514 | + if type(item) == tuple: | ||
605 | 515 | (text, key) = item | ||
606 | 516 | else: | ||
607 | 517 | text = item | ||
608 | 518 | @@ -833,9 +834,9 @@ def EntryWindow(screen, title, text, pro | ||
609 | 519 | count = 0 | ||
610 | 520 | entryList = [] | ||
611 | 521 | for n in prompts: | ||
612 | 522 | - if (type(n) == types.TupleType): | ||
613 | 523 | + if type(n) == tuple: | ||
614 | 524 | (n, e) = n | ||
615 | 525 | - if (type(e) in types.StringTypes): | ||
616 | 526 | + if isinstance(e, str if sys.version >= '3' else basestring): | ||
617 | 527 | e = Entry(entryWidth, e) | ||
618 | 528 | else: | ||
619 | 529 | e = Entry(entryWidth) | ||
620 | 0 | 530 | ||
621 | === modified file 'debian/rules' | |||
622 | --- debian/rules 2012-02-09 16:13:25 +0000 | |||
623 | +++ debian/rules 2012-06-13 21:24:19 +0000 | |||
624 | @@ -9,7 +9,6 @@ | |||
625 | 9 | # Uncomment this to turn on verbose mode. | 9 | # Uncomment this to turn on verbose mode. |
626 | 10 | # export DH_VERBOSE=1 | 10 | # export DH_VERBOSE=1 |
627 | 11 | 11 | ||
628 | 12 | |||
629 | 13 | DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) | 12 | DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
630 | 14 | DEB_BUILD_GNU_TYPE=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) | 13 | DEB_BUILD_GNU_TYPE=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
631 | 15 | ifneq ($(DEB_HOST_GNU_TYPE), $(DEB_BUILD_GNU_TYPE)) | 14 | ifneq ($(DEB_HOST_GNU_TYPE), $(DEB_BUILD_GNU_TYPE)) |
632 | @@ -23,6 +22,10 @@ | |||
633 | 23 | VERSION=0.52.11 | 22 | VERSION=0.52.11 |
634 | 24 | SONAME=0.52 | 23 | SONAME=0.52 |
635 | 25 | PYVERS=$(shell pyversions -vr debian/control) | 24 | PYVERS=$(shell pyversions -vr debian/control) |
636 | 25 | PY3VERS=$(shell py3versions -vr debian/control) | ||
637 | 26 | |||
638 | 27 | PYTHON2=$(shell pyversions -r debian/control) | ||
639 | 28 | PYTHON3=$(shell py3versions -r debian/control) | ||
640 | 26 | 29 | ||
641 | 27 | LIB_PKG=libnewt$(SONAME) | 30 | LIB_PKG=libnewt$(SONAME) |
642 | 28 | DEV_PKG=libnewt-dev | 31 | DEV_PKG=libnewt-dev |
643 | @@ -30,7 +33,10 @@ | |||
644 | 30 | TCL_PKG=newt-tcl | 33 | TCL_PKG=newt-tcl |
645 | 31 | PYTHON_PKG=python-newt | 34 | PYTHON_PKG=python-newt |
646 | 32 | PYTHON_DBG_PKG=python-newt-dbg | 35 | PYTHON_DBG_PKG=python-newt-dbg |
647 | 36 | PYTHON3_PKG=python3-newt | ||
648 | 37 | PYTHON3_DBG_PKG=python3-newt-dbg | ||
649 | 33 | WHIPTAIL_PKG=whiptail | 38 | WHIPTAIL_PKG=whiptail |
650 | 39 | EXAMPLES=peanuts.py popcorn.py | ||
651 | 34 | 40 | ||
652 | 35 | # the dbs rules | 41 | # the dbs rules |
653 | 36 | TAR_DIR=newt-$(VERSION) | 42 | TAR_DIR=newt-$(VERSION) |
654 | @@ -102,14 +108,15 @@ | |||
655 | 102 | dh_testroot | 108 | dh_testroot |
656 | 103 | dh_clean | 109 | dh_clean |
657 | 104 | rm -rf $(SOURCE_DIR) $(STAMP_DIR) | 110 | rm -rf $(SOURCE_DIR) $(STAMP_DIR) |
659 | 105 | rm -f debian/python-newt*.dirs debian/python-newt*.install debian/python-newt.postinst | 111 | rm -f debian/python-newt*.dirs debian/python*-newt*.install debian/python-newt.postinst |
660 | 112 | rm -f debian/python*-newt*.examples | ||
661 | 106 | # rm -rf debian/substvars debian/*.bak debian/*~ *~ | 113 | # rm -rf debian/substvars debian/*.bak debian/*~ *~ |
662 | 107 | 114 | ||
663 | 108 | binary: binary-indep binary-arch | 115 | binary: binary-indep binary-arch |
664 | 109 | 116 | ||
665 | 110 | binary-indep: | 117 | binary-indep: |
666 | 111 | 118 | ||
668 | 112 | binary-arch: $(LIB_PKG) $(DEV_PKG) $(PIC_PKG) $(TCL_PKG) $(PYTHON_PKG) $(PYTHON_DBG_PKG) $(WHIPTAIL_PKG) | 119 | binary-arch: $(LIB_PKG) $(DEV_PKG) $(PIC_PKG) $(TCL_PKG) $(PYTHON_PKG) $(PYTHON_DBG_PKG) $(PYTHON3_PKG) $(PYTHON3_DBG_PKG) $(WHIPTAIL_PKG) |
669 | 113 | 120 | ||
670 | 114 | $(LIB_PKG): build | 121 | $(LIB_PKG): build |
671 | 115 | dh_testdir | 122 | dh_testdir |
672 | @@ -210,17 +217,22 @@ | |||
673 | 210 | done | 217 | done |
674 | 211 | dh_installdirs -p $@ | 218 | dh_installdirs -p $@ |
675 | 212 | dh_install -p $@ --sourcedir=$(BUILD_TREE) | 219 | dh_install -p $@ --sourcedir=$(BUILD_TREE) |
678 | 213 | dh_strip -p $@ --dbg-package python-newt-dbg | 220 | dh_strip -p $@ --dbg-package $(PYTHON_DBG_PKG) |
677 | 214 | dh_python2 -p $@ | ||
679 | 215 | dh_installdocs -p $@ $(BUILD_TREE)/newt.spec | 221 | dh_installdocs -p $@ $(BUILD_TREE)/newt.spec |
680 | 216 | # Currently disabled, as debian-test has been removed. | 222 | # Currently disabled, as debian-test has been removed. |
681 | 217 | # chmod +x debian/whiptail/usr/lib/debian-test/tests/whiptail/test-newt.sh/test-newt.sh | 223 | # chmod +x debian/whiptail/usr/lib/debian-test/tests/whiptail/test-newt.sh/test-newt.sh |
682 | 218 | dh_installchangelogs -p $@ | 224 | dh_installchangelogs -p $@ |
683 | 225 | for example in $(EXAMPLES); do \ | ||
684 | 226 | echo "build-tree/*/$$example" >> debian/$@.examples; \ | ||
685 | 227 | done | ||
686 | 219 | dh_installexamples -p $@ | 228 | dh_installexamples -p $@ |
687 | 229 | sed -i "1s/^\(#! *[^ ]*\)python$\/\1$(PYTHON2)/" debian/$(@)/usr/share/doc/$(@)/examples/*.py | ||
688 | 220 | dh_compress -p $@ | 230 | dh_compress -p $@ |
689 | 221 | dh_shlibdeps -p $@ -ldebian/$@/usr/lib | 231 | dh_shlibdeps -p $@ -ldebian/$@/usr/lib |
690 | 222 | dh_fixperms -p $@ | 232 | dh_fixperms -p $@ |
691 | 223 | dh_installdeb -p $@ | 233 | dh_installdeb -p $@ |
692 | 234 | # Call after all other files have been created and installed | ||
693 | 235 | dh_python2 -p $@ | ||
694 | 224 | dh_gencontrol -p $@ | 236 | dh_gencontrol -p $@ |
695 | 225 | dh_md5sums -p $@ | 237 | dh_md5sums -p $@ |
696 | 226 | dh_builddeb -p $@ | 238 | dh_builddeb -p $@ |
697 | @@ -236,13 +248,70 @@ | |||
698 | 236 | done | 248 | done |
699 | 237 | dh_installdirs -p $@ | 249 | dh_installdirs -p $@ |
700 | 238 | dh_install -p $@ --sourcedir=$(BUILD_TREE) | 250 | dh_install -p $@ --sourcedir=$(BUILD_TREE) |
701 | 251 | mkdir -p debian/$(@)/usr/share/doc | ||
702 | 252 | ln -sf $(PYTHON_PKG) debian/$(@)/usr/share/doc/$(@) | ||
703 | 253 | dh_compress -p $@ | ||
704 | 254 | dh_shlibdeps -p $@ -ldebian/$@/usr/lib | ||
705 | 255 | dh_fixperms -p $@ | ||
706 | 256 | dh_installdeb -p $@ | ||
707 | 257 | # Call after all other files have been created and installed | ||
708 | 239 | dh_python2 -p $@ | 258 | dh_python2 -p $@ |
711 | 240 | mkdir -p debian/python-newt-dbg/usr/share/doc | 259 | dh_gencontrol -p $@ |
712 | 241 | ln -sf python-newt debian/python-newt-dbg/usr/share/doc/python-newt-dbg | 260 | dh_md5sums -p $@ |
713 | 261 | dh_builddeb -p $@ | ||
714 | 262 | |||
715 | 263 | $(PYTHON3_PKG): build | ||
716 | 264 | dh_testdir | ||
717 | 265 | dh_testroot | ||
718 | 266 | for v in $(PY3VERS); do \ | ||
719 | 267 | pylib=$$(python$$v -c 'from distutils import sysconfig; print(sysconfig.get_python_lib())'); \ | ||
720 | 268 | echo $$pylib >> debian/$@.dirs; \ | ||
721 | 269 | echo python$$v/_snackmodule.so $$pylib/ \ | ||
722 | 270 | >> debian/$@.install; \ | ||
723 | 271 | echo snack.py $$pylib \ | ||
724 | 272 | >> debian/$@.install; \ | ||
725 | 273 | done | ||
726 | 274 | dh_installdirs -p $@ | ||
727 | 275 | dh_install -p $@ --sourcedir=$(BUILD_TREE) | ||
728 | 276 | dh_strip -p $@ --dbg-package $(PYTHON3_DBG_PKG) | ||
729 | 277 | dh_installdocs -p $@ $(BUILD_TREE)/newt.spec | ||
730 | 278 | # Currently disabled, as debian-test has been removed. | ||
731 | 279 | # chmod +x debian/whiptail/usr/lib/debian-test/tests/whiptail/test-newt.sh/test-newt.sh | ||
732 | 280 | dh_installchangelogs -p $@ | ||
733 | 281 | for example in $(EXAMPLES); do \ | ||
734 | 282 | echo "build-tree/*/$$example" >> debian/$@.examples; \ | ||
735 | 283 | done | ||
736 | 284 | dh_installexamples -p $@ | ||
737 | 285 | sed -i "1s/^\(#! *[^ ]*\)python$\/\1$(PYTHON3)/" debian/$(@)/usr/share/doc/$(@)/examples/*.py | ||
738 | 286 | dh_compress -p $@ | ||
739 | 287 | dh_shlibdeps -p $@ -ldebian/$@/usr/lib | ||
740 | 288 | dh_fixperms -p $@ | ||
741 | 289 | dh_installdeb -p $@ | ||
742 | 290 | # Call after all other files have been created and installed | ||
743 | 291 | dh_python3 -p $@ | ||
744 | 292 | dh_gencontrol -p $@ | ||
745 | 293 | dh_md5sums -p $@ | ||
746 | 294 | dh_builddeb -p $@ | ||
747 | 295 | |||
748 | 296 | $(PYTHON3_DBG_PKG): build $(PYTHON3_PKG) | ||
749 | 297 | dh_testdir | ||
750 | 298 | dh_testroot | ||
751 | 299 | for v in $(PY3VERS); do \ | ||
752 | 300 | pylib=$$(python$$v -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(1))'); \ | ||
753 | 301 | echo $$pylib >> debian/$@.dirs; \ | ||
754 | 302 | echo python$$v/_snackmodule_d.so $$pylib/ \ | ||
755 | 303 | >> debian/$@.install; \ | ||
756 | 304 | done | ||
757 | 305 | dh_installdirs -p $@ | ||
758 | 306 | dh_install -p $@ --sourcedir=$(BUILD_TREE) | ||
759 | 307 | mkdir -p debian/$(@)/usr/share/doc | ||
760 | 308 | ln -sf $(PYTHON3_PKG) debian/$(@)/usr/share/doc/$(@) | ||
761 | 242 | dh_compress -p $@ | 309 | dh_compress -p $@ |
762 | 243 | dh_shlibdeps -p $@ -ldebian/$@/usr/lib | 310 | dh_shlibdeps -p $@ -ldebian/$@/usr/lib |
763 | 244 | dh_fixperms -p $@ | 311 | dh_fixperms -p $@ |
764 | 245 | dh_installdeb -p $@ | 312 | dh_installdeb -p $@ |
765 | 313 | # Call after all other files have been created and installed | ||
766 | 314 | dh_python3 -p $@ | ||
767 | 246 | dh_gencontrol -p $@ | 315 | dh_gencontrol -p $@ |
768 | 247 | dh_md5sums -p $@ | 316 | dh_md5sums -p $@ |
769 | 248 | dh_builddeb -p $@ | 317 | dh_builddeb -p $@ |
-for n in hotkeys.keys(): keys()) :
+for n in list(hotkeys.
Seems unnecessary in this case? I think this is the one Colin already reported on IRC.
- if (what._ _dict__ .has_key( 'g')):
+ if ('g' in what.__dict__):
non-idiomatic parentheses, should be dropped (as should the ones three lines above; probably not worth scrubbing all of them, but as long as we're already editing this line...)
- if (type(blist) == types.StringType):
+ if (isinstance(blist, str if sys.version >= '3' else basestring)):
there's also a 'types' import that's no longer needed as a result of this change and should be dropped. (reported by pyflakes)
- if (type(item) == types.TupleType):
+ if (type(item) == tuple):
not sure if it matters to use isinstance() here?
- if (type(e) in types.StringTypes):
+ if (type(e) in str):
doesn't this one break python2 compat? Seems like this needs the same kind of 'basestring' casing based on python version that's used elsewhere.