please see the attached patch.

I think your usage of autoreconf is wrong. why not build it --with autoreconf?
diff -Nru newt-0.52.14/debian/changelog newt-0.52.14/debian/changelog
--- newt-0.52.14/debian/changelog	2012-06-15 15:41:04.000000000 +0200
+++ newt-0.52.14/debian/changelog	2012-11-08 18:17:05.000000000 +0100
@@ -1,3 +1,24 @@
+newt (0.52.14-11ubuntu3) raring; urgency=low
+
+  * Build-depend on python3-all-dev.
+
+ -- Matthias Klose <[email protected]>  Thu, 08 Nov 2012 18:04:44 +0100
+
+newt (0.52.14-11ubuntu1) raring; urgency=low
+
+  * Merge with Debian; remaining changes:
+    - Port python module to python3.
+    - Fix installation for multiple python3 versions.
+    - Move libnewt to /lib and whiptail to /bin so they can be used by
+      friendly-recovery on systems that have a separate /usr.
+    - debian/libnewt0.52.install, debian/libnewt0.52.postinst,
+      debian/palette => debian/palette.original:
+      - move palette from /usr to /etc such that they can be edited by an
+        admin.
+  * Configure --with-colorsfile=/etc/newt/palette.
+
+ -- Matthias Klose <[email protected]>  Thu, 08 Nov 2012 14:50:00 +0100
+
 newt (0.52.14-11) unstable; urgency=low
 
   * Add Latvian translation. Closes: #674705.
diff -Nru newt-0.52.14/debian/control newt-0.52.14/debian/control
--- newt-0.52.14/debian/control	2012-06-15 15:41:04.000000000 +0200
+++ newt-0.52.14/debian/control	2012-11-08 18:04:37.000000000 +0100
@@ -1,12 +1,14 @@
 Source: newt
 Section: devel
 Priority: optional
-Maintainer: Alastair McKinstry <[email protected]>
+Maintainer: Ubuntu Developers <[email protected]>
+XSBC-Original-Maintainer: Alastair McKinstry <[email protected]>
 Standards-Version: 3.9.3
 Homepage: https://fedorahosted.org/newt/
 Vcs-Git: git://git.fedorahosted.org/git/newt
 X-Python-Version: (>= 2.5)
-Build-Depends: sgmltools-lite, libslang2-dev  (>=2.0.4-2), libpopt-dev, debhelper (>=8.1.3~), gettext, libfribidi-dev, tcl8.5-dev, python-all-dev (>= 2.6.6-3~), autoconf, python-all-dbg, dh-autoreconf
+X-Python3-Version: >= 3.2
+Build-Depends: sgmltools-lite, libslang2-dev  (>=2.0.4-2), libpopt-dev, debhelper (>=8.1.3~), gettext, libfribidi-dev, tcl8.5-dev, python-all-dev (>= 2.6.6-3~), autoconf, python-all-dbg, python3-all-dev, python3-all-dbg, dh-autoreconf
 
 Package: libnewt-dev
 Architecture: any
@@ -47,7 +49,7 @@
 Provides: ${python:Provides}
 Depends: libnewt0.52 (=${binary:Version}) , ${python:Depends}, ${misc:Depends}, ${shlibs:Depends}
 Description: NEWT module for Python
- This module allows you to built a text UI for your Python scripts
+ This module allows you to build a text UI for your Python scripts
  using newt.
 
 Package: python-newt-dbg
@@ -56,11 +58,31 @@
 Priority: extra
 Depends: libnewt0.52 (=${binary:Version}), python-newt (=${binary:Version}), python-dbg, ${misc:Depends}, ${shlibs:Depends}
 Description: NEWT module for Python (debug extension)
- This module allows you to built a text UI for your Python scripts
+ This module allows you to build a text UI for your Python scripts
  using newt.
  .
  This package contains the extension built for the Python debug interpreter.
 
+Package: python3-newt
+Architecture: any
+Section: python
+Priority: optional
+Provides: ${python3:Provides}
+Depends: libnewt0.52 (=${binary:Version}) , ${python3:Depends}, ${misc:Depends}, ${shlibs:Depends}
+Description: NEWT module for Python 3
+ This module allows you to build a text UI for your Python 3 scripts
+ using newt.
+
+Package: python3-newt-dbg
+Architecture: any
+Section: debug
+Priority: extra
+Depends: libnewt0.52 (=${binary:Version}), python3-newt (=${binary:Version}), python3-dbg, ${misc:Depends}, ${shlibs:Depends}
+Description: NEWT module for Python 3 (debug extension)
+ This module allows you to build a text UI for your Python 3 scripts
+ using newt.
+ .
+ This package contains the extension built for the Python debug interpreter.
 
 Package: libnewt0.52
 Architecture: any
diff -Nru newt-0.52.14/debian/patches/python3.patch newt-0.52.14/debian/patches/python3.patch
--- newt-0.52.14/debian/patches/python3.patch	1970-01-01 01:00:00.000000000 +0100
+++ newt-0.52.14/debian/patches/python3.patch	2012-11-08 16:05:36.000000000 +0100
@@ -0,0 +1,557 @@
+Index: b/Makefile.in
+===================================================================
+--- a/Makefile.in	2012-11-08 15:04:46.651999096 +0000
++++ b/Makefile.in	2012-11-08 15:05:29.931998376 +0000
+@@ -12,7 +12,7 @@
+ TAG = r$(subst .,-,$(VERSION))
+ SONAME = @SONAME@
+ 
+-PYTHONVERS =  $(shell pyversions --supported)
++PYTHONVERS =  $(shell pyversions --supported; py3versions --supported)
+ WHIPTCLSO = @WHIPTCLSO@
+ 
+ PROGS = test whiptail $(WHIPTCLSO) testgrid testtree showchars showkey
+@@ -77,16 +77,19 @@
+ 	$(CC) -g -o showkey showkey.o $(LIBNEWT) $(LDFLAGS) $(LIBS)
+ 
+ _snackmodule.so:   snackmodule.c $(LIBNEWTSH)
++	set -ex; \
+ 	[ -n "$(PYTHONVERS)" ] && for ver in $(PYTHONVERS) ; do \
++	    for variant in '' '-dbg'; do \
++		case "$$ver" in \
++		python3*) abitag=.$$($$ver$$variant -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))");; \
++		*) if [ -n "$$variant" ]; then abitag=; else abitag=_d; fi; \
++		esac; \
+ 	    	mkdir -p $$ver ;\
+-			PCFLAGS=`$$ver-config --cflags`; \
+-			PIFLAGS=`$$ver-config --includes`; \
+-			PLDFLAGS=`$$ver-config --ldflags | sed -e 's/\-lpython[0-9.]*//'`; \
+-			PLFLAGS=`$$ver-config --libs | sed -e 's/\-lpython[0-9.]*//'`; \
+-	        $(CC) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -fPIC -c -o $$ver/snackmodule.o snackmodule.c ;\
+-	        $(CC) --shared -fPIC $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snackmodule.so $$ver/snackmodule.o -L.  -lnewt $(LIBS);\
+-                $(CC) $(subst -O2,-O0,$(CFLAGS)) -I/usr/include/$${ver}_d -fPIC -c -o $$ver/snackmodule_d.o snackmodule.c ;\
+-                $(CC) --shared -fPIC  $(SHCFLAGS) -o $$ver/_snackmodule_d.so $$ver/snackmodule_d.o -L .  -lnewt  ;\
++		PCFLAGS=`$$ver$$variant-config --cflags`; \
++		PLDFLAGS=`$$ver$$variant-config --ldflags | sed -e 's/\-lpython[^ ]*//'`; \
++	        $(CC) $(CPPFLAGS) $$PCFLAGS -fPIC -c -o $$ver/snackmodule.o snackmodule.c ;\
++	        $(CC) --shared -fPIC $$PLDFLAGS $(LDFLAGS) -o $$ver/_snack$$abitag.so $$ver/snackmodule.o -L.  -lnewt $(LIBS);\
++	    done; \
+ 	done || :
+ 	touch $@
+ 
+@@ -144,9 +147,14 @@
+ 	ln -sf $(LIBNEWTSH) $(instroot)/$(libdir)/$(LIBNEWTSONAME)
+ 	[ -n "$(WHIPTCLSO)" ] && install -m 755 whiptcl.so $(instroot)/$(libdir) || :
+ 	[ -n "$(PYTHONVERS)" ] && for ver in $(PYTHONVERS) ; do \
++	 for variant in '' '-dbg'; do \
++	    case "$$ver" in \
++	    python3*) abitag=.$$($$ver$$variant -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))");; \
++	    *) if [ -n "$$variant" ]; then abitag=; else abitag=_d; fi; \
++	    esac; \
+ 	   [ -d $(instroot)/$(libdir)/$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/$$ver/site-packages ;\
+-	   install -m 755 $$ver/_snackmodule.so $(instroot)/$(libdir)/$$ver/site-packages ;\
+-	   install -m 755 $$ver/_snackmodule_d.so $(instroot)/$(libdir)/$$ver/site-packages ;\
++	   install -m 755 $$ver/_snack$$abitag.so $(instroot)/$(libdir)/$$ver/site-packages ;\
++	 done; \
+ 	   install -m 644 snack.py $(instroot)/$(libdir)/$$ver/site-packages ;\
+ 	done || :
+ 
+Index: b/peanuts.py
+===================================================================
+--- a/peanuts.py	2011-12-02 12:59:49.000000000 +0000
++++ b/peanuts.py	2012-11-08 15:05:29.931998376 +0000
+@@ -2,6 +2,7 @@
+ 
+ # Demo program to show use of python-newt module
+ 
++from __future__ import absolute_import, print_function, unicode_literals
+ from snack import *
+ 
+ screen = SnackScreen()
+@@ -38,8 +39,8 @@
+ 
+ screen.finish()
+ 
+-print result
+-print "listbox:", li.current()
+-print "rb:", rb.getSelection()
+-print "bb:", bb.buttonPressed(result)
+-print "checkboxtree:", ct.getSelection()
++print(result)
++print("listbox:", li.current())
++print("rb:", rb.getSelection())
++print("bb:", bb.buttonPressed(result))
++print("checkboxtree:", ct.getSelection())
+Index: b/popcorn.py
+===================================================================
+--- a/popcorn.py	2011-12-02 12:59:49.000000000 +0000
++++ b/popcorn.py	2012-11-08 15:05:29.935998375 +0000
+@@ -1,5 +1,6 @@
+ #!/usr/bin/python
+ 
++from __future__ import absolute_import, print_function, unicode_literals
+ from snack import *
+ import sys
+ 
+@@ -45,7 +46,7 @@
+ r2 = SingleRadioButton("Radio 2", r1)
+ 
+ def something():
+-    print hello
++    print(hello)
+ 
+ screen = SnackScreen()
+ 
+@@ -99,14 +100,14 @@
+ 
+ screen.finish()
+ 
+-print "val", e.value()
+-print "check", cb.value()
+-print "r1", r1.selected()
+-print "listbox", li.current()
++print("val", e.value())
++print("check", cb.value())
++print("r1", r1.selected())
++print("listbox", li.current())
+ # returns a tuple of the wrapped text, the actual width, and the actual height
+-print res
++print(res)
+ 
+-print foo
+-print 'lbcw', lbcw
+-print "ct selected", ct.getSelection()
+-print "ct current", ct.getCurrent()
++print(foo)
++print('lbcw', lbcw)
++print("ct selected", ct.getSelection())
++print("ct current", ct.getCurrent())
+Index: b/snackmodule.c
+===================================================================
+--- a/snackmodule.c	2012-11-08 14:58:07.000000000 +0000
++++ b/snackmodule.c	2012-11-08 15:05:29.935998375 +0000
+@@ -12,10 +12,24 @@
+ #include <unistd.h>
+ 
+ #include "Python.h"
++#include "structmember.h"
+ #include "nls.h"
+ #include "newt.h"
+ #include "newt_pr.h"
+ 
++#if PY_MAJOR_VERSION >= 3
++  #define PyInt_FromLong PyLong_FromLong
++  #define PyInt_AsLong PyLong_AsLong
++  #define PyString_FromString PyUnicode_FromString
++  #define MOD_ERROR_VAL NULL
++  #define MOD_SUCCESS_VAL(val) val
++  #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void)
++#else
++  #define MOD_ERROR_VAL
++  #define MOD_SUCCESS_VAL(val)
++  #define MOD_INIT(name) void init##name(void)
++#endif
++
+ typedef struct snackWidget_s snackWidget;
+ typedef struct snackGrid_s snackGrid;
+ typedef struct snackForm_s snackForm;
+@@ -68,6 +82,8 @@
+ static PyObject * ternaryWindow(PyObject * s, PyObject * args);
+ static snackWidget * checkboxTreeWidget(PyObject * s, PyObject * args, PyObject * kwargs);
+ static PyObject * pywstrlen(PyObject * s, PyObject * args);
++static PyObject * widget_get_checkboxValue(PyObject *self, void *closure);
++static PyObject * widget_get_radioValue(PyObject *self, void *closure);
+ 
+ static PyMethodDef snackModuleMethods[] = {
+     { "button", (PyCFunction) buttonWidget, METH_VARARGS, NULL },
+@@ -107,12 +123,31 @@
+     { NULL }
+ } ;
+ 
++#if PY_MAJOR_VERSION >= 3
++static struct PyModuleDef moduledef = {
++    PyModuleDef_HEAD_INIT,
++        "_snack",            /* m_name */
++        NULL,                /* m_doc */
++        -1,                  /* m_size */
++        snackModuleMethods,  /* m_methods */
++        NULL,                /* m_reload */
++        NULL,                /* m_traverse */
++        NULL,                /* m_clear */
++        NULL,                /* m_free */
++    };
++#endif
++
++static struct PyGetSetDef widget_getset[] = {
++        { "checkboxValue", widget_get_checkboxValue, 0, NULL, NULL },
++        { "radioValue", widget_get_radioValue, 0, NULL, NULL },
++        { NULL }
++};
++
+ struct snackGrid_s {
+     PyObject_HEAD
+     newtGrid grid;
+ } ;
+ 
+-static PyObject * gridGetAttr(PyObject * s, char * name);
+ static PyObject * gridPlace(snackGrid * s, PyObject * args);
+ static PyObject * gridSetField(snackGrid * s, PyObject * args);
+ 
+@@ -123,20 +158,34 @@
+ };
+ 
+ static PyTypeObject snackGridType = {
+-        PyObject_HEAD_INIT(&PyType_Type)
+-        0,                              /* ob_size */
++        PyVarObject_HEAD_INIT(&PyType_Type, 0)
+         "snackgrid",                    /* tp_name */
+         sizeof(snackGrid),              /* tp_size */
+         0,                              /* tp_itemsize */
+         emptyDestructor,      			/* tp_dealloc */
+         0,                              /* tp_print */
+-        gridGetAttr,    		/* tp_getattr */
++        0,                   		/* tp_getattr */
+         0,                              /* tp_setattr */
+         0,                              /* tp_compare */
+         0,                              /* tp_repr */
+         0,                              /* tp_as_number */
+         0,                              /* tp_as_sequence */
+         0,                		/* tp_as_mapping */
++	0,                              /* tp_hash */
++	0,                              /* tp_call */
++	0,                              /* tp_str */
++	PyObject_GenericGetAttr,        /* tp_getattro */
++	0,                              /* tp_setattro */
++	0,                              /* tp_as_buffer */
++	Py_TPFLAGS_DEFAULT,             /* tp_flags */
++	0,                              /* tp_doc */
++	0,                              /* tp_traverse */
++	0,                              /* tp_clear */
++	0,                              /* tp_richcompare */
++	0,                              /* tp_weaklistoffset */
++	0,                              /* tp_iter */
++	0,                              /* tp_iternext */
++	gridMethods                     /* tp_methods */
+ };
+ 
+ struct snackForm_s {
+@@ -144,7 +193,6 @@
+     newtComponent fo;
+ } ;
+ 
+-static PyObject * formGetAttr(PyObject * s, char * name);
+ static PyObject * formAdd(snackForm * s, PyObject * args);
+ static PyObject * formDraw(snackForm * s, PyObject * args);
+ static PyObject * formRun(snackForm * s, PyObject * args);
+@@ -165,20 +213,34 @@
+ };
+ 
+ static PyTypeObject snackFormType = {
+-        PyObject_HEAD_INIT(&PyType_Type)
+-        0,                              /* ob_size */
++        PyVarObject_HEAD_INIT(&PyType_Type, 0)
+         "snackform",                    /* tp_name */
+         sizeof(snackForm),              /* tp_size */
+         0,                              /* tp_itemsize */
+         emptyDestructor,      		/* tp_dealloc */
+         0,                              /* tp_print */
+-        formGetAttr,    		/* tp_getattr */
++        0,                     		/* tp_getattr */
+         0,                              /* tp_setattr */
+         0,                              /* tp_compare */
+         0,                              /* tp_repr */
+         0,                              /* tp_as_number */
+         0,                              /* tp_as_sequence */
+         0,                		/* tp_as_mapping */
++	0,                              /* tp_hash */
++	0,                              /* tp_call */
++	0,                              /* tp_str */
++	PyObject_GenericGetAttr,        /* tp_getattro */
++	0,                              /* tp_setattro */
++	0,                              /* tp_as_buffer */
++	Py_TPFLAGS_DEFAULT,             /* tp_flags */
++	0,                              /* tp_doc */
++	0,                              /* tp_traverse */
++	0,                              /* tp_clear */
++	0,                              /* tp_richcompare */
++	0,                              /* tp_weaklistoffset */
++	0,                              /* tp_iter */
++	0,                              /* tp_iternext */
++	formMethods                     /* tp_methods */
+ };
+ 
+ struct snackWidget_s {
+@@ -191,7 +253,6 @@
+ } ;
+ 
+ static PyObject * widgetAddCallback(snackWidget * s, PyObject * args);
+-static PyObject * widgetGetAttr(PyObject * s, char * name);
+ static void widgetDestructor(PyObject * s);
+ static PyObject * widgetEntrySetValue(snackWidget * s, PyObject * args);
+ static PyObject * widgetLabelText(snackWidget * s, PyObject * args);
+@@ -255,21 +316,43 @@
+     { NULL }
+ };
+ 
++static PyMemberDef widget_members[] = {
++        { "key" , T_INT, offsetof(snackWidget, co), 0, NULL },
++        { "entryValue", T_STRING, offsetof(snackWidget, apointer), 0, NULL },
++	{ NULL }
++};
++
+ static PyTypeObject snackWidgetType = {
+-        PyObject_HEAD_INIT(&PyType_Type)
+-        0,                              /* ob_size */
++        PyVarObject_HEAD_INIT(&PyType_Type, 0)
+         "snackwidget",                  /* tp_name */
+         sizeof(snackWidget),            /* tp_size */
+         0,                              /* tp_itemsize */
+         widgetDestructor,      		/* tp_dealloc */
+         0,                              /* tp_print */
+-        widgetGetAttr,  		/* tp_getattr */
++        0,                   		/* tp_getattr */
+         0,                              /* tp_setattr */
+         0,                              /* tp_compare */
+         0,                              /* tp_repr */
+         0,                              /* tp_as_number */
+         0,                              /* tp_as_sequence */
+         0,                		/* tp_as_mapping */
++	0,                              /* tp_hash */
++	0,                              /* tp_call */
++	0,                              /* tp_str */
++	PyObject_GenericGetAttr,        /* tp_getattro */
++	0,                              /* tp_setattro */
++	0,                              /* tp_as_buffer */
++	Py_TPFLAGS_DEFAULT,             /* tp_flags */
++	0,                              /* tp_doc */
++	0,                              /* tp_traverse */
++	0,                              /* tp_clear */
++	0,                              /* tp_richcompare */
++	0,                              /* tp_weaklistoffset */
++	0,                              /* tp_iter */
++	0,                              /* tp_iternext */
++	widgetMethods,                  /* tp_methods */
++	widget_members,                 /* tp_members */
++	widget_getset                   /* tp_getset */
+ };
+ 
+ static snackWidget * snackWidgetNew (void) {
+@@ -843,10 +926,6 @@
+     return grid;
+ }
+ 
+-static PyObject * gridGetAttr(PyObject * s, char * name) {
+-    return Py_FindMethod(gridMethods, s, name);
+-}
+-
+ static PyObject * gridPlace(snackGrid * grid, PyObject * args) {
+     int x, y;
+ 
+@@ -870,7 +949,7 @@
+ 				&anchorFlags, &growFlags)) 
+ 	return NULL;
+ 
+-    if (w->ob_type == &snackWidgetType) {
++    if (Py_TYPE(w) == &snackWidgetType) {
+ 	newtGridSetField(grid->grid, x, y, NEWT_GRID_COMPONENT,
+ 			 w->co, pLeft, pTop, pRight, pBottom, anchorFlags, 
+ 			 growFlags);
+@@ -885,10 +964,6 @@
+     return Py_None;
+ }
+ 
+-static PyObject * formGetAttr(PyObject * s, char * name) {
+-    return Py_FindMethod(formMethods, s, name);
+-}
+-
+ static PyObject * formDraw(snackForm * s, PyObject * args) {
+     newtDrawForm(s->fo);
+ 
+@@ -980,20 +1055,18 @@
+     return Py_None;
+ }
+ 
+-static PyObject * widgetGetAttr(PyObject * s, char * name) {
+-    snackWidget * w = (snackWidget *) s;
++static PyObject * widget_get_checkboxValue(PyObject *self, void *closure)
++{
++	snackWidget *w = (snackWidget *)self;
+ 
+-    if (!strcmp(name, "key")) {
+-	return Py_BuildValue("i", w->co);
+-    } else if (!strcmp(name, "entryValue")) {
+-	return Py_BuildValue("s", w->apointer);
+-    } else if (!strcmp(name, "checkboxValue")) {
+ 	return Py_BuildValue("i", w->achar == ' ' ? 0 : 1);
+-    } else if (!strcmp(name, "radioValue")) {
+-	return Py_BuildValue("i", newtRadioGetCurrent(w->co));
+-    }
++}
++
++static PyObject * widget_get_radioValue(PyObject *self, void *closure)
++{
++	snackWidget *w = (snackWidget *)self;
+ 
+-    return Py_FindMethod(widgetMethods, s, name);
++	return Py_BuildValue("i", newtRadioGetCurrent(w->co));
+ }
+ 
+ static void widgetDestructor(PyObject * o) {
+@@ -1321,10 +1394,19 @@
+     return PyInt_FromLong(wstrlen(str, len));
+ }
+ 
+-void init_snack(void) {
++MOD_INIT(_snack)
++{
+     PyObject * d, * m;
+ 
++#if PY_MAJOR_VERSION >= 3
++    m = PyModule_Create(&moduledef);
++#else
+     m = Py_InitModule("_snack", snackModuleMethods);
++#endif
++
++    if (! m)
++	    return MOD_ERROR_VAL;
++
+     d = PyModule_GetDict(m);
+ 
+     PyDict_SetItemString(d, "ANCHOR_LEFT", PyInt_FromLong(NEWT_ANCHOR_LEFT));
+@@ -1401,4 +1483,6 @@
+     PyDict_SetItemString(d, "COLORSET_COMPACTBUTTON", PyInt_FromLong(NEWT_COLORSET_COMPACTBUTTON));
+     PyDict_SetItemString(d, "COLORSET_ACTSELLISTBOX", PyInt_FromLong(NEWT_COLORSET_ACTSELLISTBOX));
+     PyDict_SetItemString(d, "COLORSET_SELLISTBOX", PyInt_FromLong(NEWT_COLORSET_SELLISTBOX));
++
++    return MOD_SUCCESS_VAL(m);
+ }
+Index: b/snack.py
+===================================================================
+--- a/snack.py	2011-12-02 12:59:49.000000000 +0000
++++ b/snack.py	2012-11-08 15:05:29.935998375 +0000
+@@ -39,9 +39,10 @@
+  - EntryWindow
+ """
+ 
++
++from __future__ import absolute_import, print_function, unicode_literals
+ import _snack
+-import types
+-import string
++import sys
+ 
+ from _snack import FLAG_DISABLED, FLAGS_SET, FLAGS_RESET, FLAGS_TOGGLE, FD_READ, FD_WRITE, FD_EXCEPT
+ 
+@@ -304,7 +305,7 @@
+             "INSERT": _snack.KEY_INSERT,
+              " " : ord(" ") }
+ 
+-for n in hotkeys.keys():
++for n in list(hotkeys.keys()):
+     hotkeys[hotkeys[n]] = n
+ for o,c in [ (ord(c),c) for c in string.ascii_letters+string.digits ]:
+     hotkeys[c] = o
+@@ -328,14 +329,14 @@
+         self.w.addhotkey(hotkeys[keyname])
+ 
+     def add(self, widget):
+-        if widget.__dict__.has_key('hotkeys'):
++        if 'hotkeys' in widget.__dict__:
+             for key in widget.hotkeys.keys():
+                 self.addHotKey(key)
+ 
+-        if widget.__dict__.has_key('gridmembers'):
++        if 'gridmembers' in widget.__dict__:
+             for w in widget.gridmembers:
+                 self.add(w)
+-        elif widget.__dict__.has_key('w'):
++        elif 'w' in widget.__dict__:
+             self.trans[widget.w.key] = widget
+             return self.w.add(widget.w)
+         return None
+@@ -408,14 +409,14 @@
+         if (growy):
+             gridFlags = gridFlags | _snack.GRID_GROWY
+ 
+-        if (what.__dict__.has_key('g')):
++        if 'g' in what.__dict__:
+             return self.g.setfield(col, row, what.g, padding, anchorFlags,
+                        gridFlags)
+         else:
+             return self.g.setfield(col, row, what.w, padding, anchorFlags)
+     
+     def __init__(self, *args):
+-        self.g = apply(_snack.grid, args)
++        self.g = _snack.grid(*args)
+         self.gridmembers = []
+ 
+ colorsets = { "ROOT" : _snack.COLORSET_ROOT,
+@@ -481,7 +482,7 @@
+     
+     def helpCallback(self, cb):
+     	self.helpCb = cb
+-        return _snack.helpcallback(self.doHelpCallback)
++    	return _snack.helpcallback(self.doHelpCallback)
+ 
+     def suspendCallback(self, cb, data = None):
+         if data:
+@@ -604,9 +605,9 @@
+         self.item = 0
+         Grid.__init__(self, len(buttonlist), 1)
+         for blist in buttonlist:
+-            if (type(blist) == types.StringType):
++            if isinstance(blist, str if sys.version >= '3' else basestring):
+                 title = blist
+-                value = string.lower(blist)
++                value = blist.lower()
+             elif len(blist) == 2:
+                 (title, value) = blist
+             else:
+@@ -622,7 +623,7 @@
+             self.item = self.item + 1
+ 
+     def buttonPressed(self, result):    
+-        if self.hotkeys.has_key(result):
++        if result in self.hotkeys:
+             return self.hotkeys[result]
+ 
+         for (button, value) in self.list:
+@@ -657,7 +658,7 @@
+         self.form_created = 0
+         args = list(args)
+         args[:0] = [self]
+-        apply(Grid.__init__, tuple(args))
++        Grid.__init__(*tuple(args))
+ 
+     def add(self, widget, col, row, padding = (0, 0, 0, 0),
+             anchorLeft = 0, anchorTop = 0, anchorRight = 0,
+@@ -713,7 +714,7 @@
+     """
+     def __init__(self, screen, title, *args):
+         myargs = (self, screen, title, None) + args
+-        apply(GridFormHelp.__init__, myargs)
++        GridFormHelp.__init__(*myargs)
+ 
+ class CheckboxTree(Widget):
+     """ CheckboxTree combo widget,
+@@ -788,7 +789,7 @@
+     l = Listbox(height, scroll = scroll, returnExit = 1)
+     count = 0
+     for item in items:
+-        if (type(item) == types.TupleType):
++        if type(item) == tuple:
+             (text, key) = item
+         else:
+             text = item
+@@ -848,9 +849,9 @@
+     count = 0
+     entryList = []
+     for n in prompts:
+-        if (type(n) == types.TupleType):
++        if type(n) == tuple:
+             (n, e) = n
+-            if (type(e) in types.StringTypes):
++            if isinstance(e, str if sys.version >= '3' else basestring):
+                 e = Entry(entryWidth, e)
+         else:
+             e = Entry(entryWidth)
diff -Nru newt-0.52.14/debian/patches/series newt-0.52.14/debian/patches/series
--- newt-0.52.14/debian/patches/series	2012-06-15 15:41:04.000000000 +0200
+++ newt-0.52.14/debian/patches/series	2012-11-08 16:28:52.000000000 +0100
@@ -21,3 +21,4 @@
 welsh.patch
 lithuanian.patch
 latvian.patch
+python3.patch
diff -Nru newt-0.52.14/debian/python3-newt-dbg.dirs newt-0.52.14/debian/python3-newt-dbg.dirs
--- newt-0.52.14/debian/python3-newt-dbg.dirs	1970-01-01 01:00:00.000000000 +0100
+++ newt-0.52.14/debian/python3-newt-dbg.dirs	2012-11-08 16:47:49.000000000 +0100
@@ -0,0 +1 @@
+/usr/lib/python3/dist-packages
diff -Nru newt-0.52.14/debian/python3-newt.dirs newt-0.52.14/debian/python3-newt.dirs
--- newt-0.52.14/debian/python3-newt.dirs	1970-01-01 01:00:00.000000000 +0100
+++ newt-0.52.14/debian/python3-newt.dirs	2012-11-08 16:47:55.000000000 +0100
@@ -0,0 +1 @@
+/usr/lib/python3/dist-packages
diff -Nru newt-0.52.14/debian/rules newt-0.52.14/debian/rules
--- newt-0.52.14/debian/rules	2012-06-15 15:41:04.000000000 +0200
+++ newt-0.52.14/debian/rules	2012-11-08 16:50:05.000000000 +0100
@@ -11,12 +11,17 @@
 
 # Magic debhelper rule.
 %:
-	dh $@ --with python2
+	dh $@ --with python2,python3
 
 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
-LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH)
+LIBDIR:=/lib/$(DEB_HOST_MULTIARCH)
+USRLIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH)
 DEB_HOST_ARCH_OS  ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
 PYVERS:=$(shell pyversions --supported)
+PY3VERS:=$(shell py3versions --supported)
+
+PYTHON2=$(shell pyversions -r debian/control)
+PYTHON3=$(shell py3versions -r debian/control)
 
 ifeq ($(DEB_HOST_ARCH_OS),hurd)
 GPMSUPPORT=
@@ -30,35 +35,57 @@
 NOSTRIP=--with-nostrip=yes
 endif
 
+COLORSFILE = --with-colorsfile=/etc/newt/palette
+
 override_dh_auto_clean:
 	dh_auto_clean
 	# remove autogenerated files
 	rm -rf Makefile config.h* config.log config.status .depend libnewt.pc \
 	   configure install-sh po/*.mo python* tutorial libnewt_pic.a
 	rm -f debian/shlibs.local
+	rm -f debian/python*-newt*.examples 
 
 override_dh_auto_configure:
 	dh_autoreconf 
 	# Nasty hack. why is it necessary?
 	cp /usr/share/automake-1.11/install-sh ./install-sh
-	dh_auto_configure  -- $(GPMSUPPORT) $(NOSTRIP)  CFLAGS="-I/usr/include/tcl8.5 $(CFLAGS)"  \
+	dh_auto_configure  -- $(GPMSUPPORT) $(NOSTRIP) $(COLORSFILE) CFLAGS="-I/usr/include/tcl8.5 $(CFLAGS)"  \
 		CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" FFLAGS="$(FFLAGS)" 
 
 override_dh_auto_build:
 	dh_auto_build
 	sgmltools --backend html tutorial.sgml
 	ar cqv libnewt_pic.a shared/*.o
-	
-	
+
+
 override_dh_auto_install:
 	dh_auto_install 
+	mkdir -p debian/tmp/$(LIBDIR)/.
+	mv debian/tmp/$(USRLIBDIR)/*.so.* debian/tmp/$(LIBDIR)/.
+
 	for v in $(PYVERS); do \
 		pylib=usr/lib/$$v/dist-packages ; \
 		mkdir -p debian/python-newt/$$pylib ; \
 		mkdir -p debian/python-newt-dbg/$$pylib ;\
-		mv $$v/*snackmodule_d.* debian/python-newt-dbg/$$pylib; \
+		mv $$v/_snack_d.* debian/python-newt-dbg/$$pylib; \
 		cp snack.py $$v/* debian/python-newt/$$pylib; \
 	done
-	dh_install -p libnewt-dev libnewt.a $(LIBDIR)
-	mkdir -p debian/libnewt-pic/$(LIBDIR)
-	cp newt*.ver debian/libnewt-pic/$(LIBDIR)/libnewt_pic.map
+	for v in $(PY3VERS); do \
+		pylib=usr/lib/python3/dist-packages ; \
+		abitag=.$$($$v-dbg -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))"); \
+		mkdir -p debian/python3-newt/$$pylib ; \
+		mkdir -p debian/python3-newt-dbg/$$pylib ;\
+		mv $$v/_snack$$abitag.so debian/python3-newt-dbg/$$pylib/; \
+		cp snack.py $$v/* debian/python3-newt/$$pylib; \
+	done
+	-find debian/python-* debian/python3-* -name '*.o' | xargs rm -f
+
+	dh_install -p libnewt-dev libnewt.a $(USRLIBDIR)
+	mkdir -p debian/libnewt-pic/$(USRLIBDIR)
+	cp newt*.ver debian/libnewt-pic/$(USRLIBDIR)/libnewt_pic.map
+
+
+override_dh_strip:
+	dh_strip -Npython-newt -Npython-newt-dbg -Npython3-newt -Npython3-newt-dbg
+	dh_strip -ppython-newt --dbg-package=python-newt-dbg
+	dh_strip -ppython3-newt --dbg-package=python3-newt-dbg

Reply via email to