Re: [Python-Dev] NetBSD and curses

2011-03-15 Thread Gregory P. Smith
Would you please post this to bugs.python.org so that it doesn't get lost?
 thanks!

-gps

On Mon, Mar 14, 2011 at 8:51 PM, Bill Green b...@supposedly.org wrote:

 Hi all,

 I ran across this issue several months ago and filed a bug report (#9667).
  It just came up again, and it doesn't look like anything's been done with
 the bug report, so I thought I'd post here.

 In _cursesmodule.c there are a lot of preprocesser conditionals that test
 if the system is NetBSD. In my case, the issue was that the module built
 lacked the KEY_UP / _DOWN / etc. constants, but there are other changes as
 well.  This is the case even if you're compiling against ncurses instead of
 the system curses.  Αttached below is a patch against 2.7.1 that negates the
 NetBSD conditionals if ncurses is present.  It seems to work as expected,
 although I haven't done any real testing.  I assumed this was done because
 NetBSD curses was missing something, but I looked at the headers and it
 seems to have most of the constants that the compilation directives are
 leaving out (A_INVIS, the aforementioned KEY_* constants, at least), so I'm
 not sure why that code isn't compiled in anyway.  Please let me know if I'm
 misunderstanding this.

 Thanks,
 Bill

 ___
 Python-Dev mailing list
 Python-Dev@python.org
 http://mail.python.org/mailman/listinfo/python-dev
 Unsubscribe:
 http://mail.python.org/mailman/options/python-dev/greg%40krypto.org


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] NetBSD and curses

2011-03-15 Thread Gregory P. Smith
Hi, Sorry, it was just laughingly pointed out to me that I responded to your
complaint about a bug being ignored by asking you to file a bug. :)  Thats
what I get for reading things late at night.

regardless, any time you have a patch for something, please attach it to the
issue, things on the mailing list get lost.  I've gone ahead and attached
the patch and accepted the issue.  I have a netbsd ec2 instance to test with
now but haven't had time to get it setup for python development.

None of the devs currently run netbsd on a regular basis or have much
experience with it as a platform so patches are a great help.  Any chance
you can also make a version of the patch that applies against hg cpython tip
(3.3)?

-gps

2011/3/15 Gregory P. Smith g...@krypto.org

 Would you please post this to bugs.python.org so that it doesn't get lost?
  thanks!

 -gps

 On Mon, Mar 14, 2011 at 8:51 PM, Bill Green b...@supposedly.org wrote:

 Hi all,

 I ran across this issue several months ago and filed a bug report (#9667).
  It just came up again, and it doesn't look like anything's been done with
 the bug report, so I thought I'd post here.

 In _cursesmodule.c there are a lot of preprocesser conditionals that test
 if the system is NetBSD. In my case, the issue was that the module built
 lacked the KEY_UP / _DOWN / etc. constants, but there are other changes as
 well.  This is the case even if you're compiling against ncurses instead of
 the system curses.  Αttached below is a patch against 2.7.1 that negates the
 NetBSD conditionals if ncurses is present.  It seems to work as expected,
 although I haven't done any real testing.  I assumed this was done because
 NetBSD curses was missing something, but I looked at the headers and it
 seems to have most of the constants that the compilation directives are
 leaving out (A_INVIS, the aforementioned KEY_* constants, at least), so I'm
 not sure why that code isn't compiled in anyway.  Please let me know if I'm
 misunderstanding this.

 Thanks,
 Bill

 ___
 Python-Dev mailing list
 Python-Dev@python.org
 http://mail.python.org/mailman/listinfo/python-dev
 Unsubscribe:
 http://mail.python.org/mailman/options/python-dev/greg%40krypto.org



___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] NetBSD and curses

2011-03-14 Thread Bill Green

Hi all,

I ran across this issue several months ago and filed a bug report 
(#9667).  It just came up again, and it doesn't look like anything's 
been done with the bug report, so I thought I'd post here.


In _cursesmodule.c there are a lot of preprocesser conditionals that 
test if the system is NetBSD. In my case, the issue was that the module 
built lacked the KEY_UP / _DOWN / etc. constants, but there are other 
changes as well.  This is the case even if you're compiling against 
ncurses instead of the system curses.  Αttached below is a patch against 
2.7.1 that negates the NetBSD conditionals if ncurses is present.  It 
seems to work as expected, although I haven't done any real testing.  I 
assumed this was done because NetBSD curses was missing something, but I 
looked at the headers and it seems to have most of the constants that 
the compilation directives are leaving out (A_INVIS, the aforementioned 
KEY_* constants, at least), so I'm not sure why that code isn't compiled 
in anyway.  Please let me know if I'm misunderstanding this.


Thanks,
Bill
--- Python-2.7.1/Modules/_cursesmodule.c2011-03-13 23:34:27.0 
-0700
+++ Python-2.7.1/Modules/_cursesmodule.c.1  2011-03-14 00:33:09.0 
-0700
@@ -322,13 +322,13 @@
 
 Window_OneArgNoReturnFunction(clearok, int, i;True(1) or False(0))
 Window_OneArgNoReturnFunction(idlok, int, i;True(1) or False(0))
-#if defined(__NetBSD__)
+#if defined(__NetBSD__)  !defined(HAVE_NCURSES_H)
 Window_OneArgNoReturnVoidFunction(keypad, int, i;True(1) or False(0))
 #else
 Window_OneArgNoReturnFunction(keypad, int, i;True(1) or False(0))
 #endif
 Window_OneArgNoReturnFunction(leaveok, int, i;True(1) or False(0))
-#if defined(__NetBSD__)
+#if defined(__NetBSD__)  !defined(HAVE_NCURSES_H)
 Window_OneArgNoReturnVoidFunction(nodelay, int, i;True(1) or False(0))
 #else
 Window_OneArgNoReturnFunction(nodelay, int, i;True(1) or False(0))
@@ -891,7 +891,7 @@
 return Py_BuildValue(c, rtn);
 } else {
 const char *knp;
-#if defined(__NetBSD__)
+#if defined(__NetBSD__)  !defined(HAVE_NCURSES_H)
 knp = unctrl(rtn);
 #else
 knp = keyname(rtn);
@@ -2108,7 +2108,7 @@
 }
 #endif /* HAVE_CURSES_IS_TERM_RESIZED */
 
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) || defined(HAVE_NCURSES_H)
 static PyObject *
 PyCurses_KeyName(PyObject *self, PyObject *args)
 {
@@ -2672,7 +2672,7 @@
 #ifdef HAVE_CURSES_IS_TERM_RESIZED
 {is_term_resized, (PyCFunction)PyCurses_Is_Term_Resized, 
METH_VARARGS},
 #endif
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) || defined(HAVE_NCURSES_H)
 {keyname, (PyCFunction)PyCurses_KeyName, METH_VARARGS},
 #endif
 {killchar,(PyCFunction)PyCurses_KillChar, METH_NOARGS},
@@ -2783,7 +2783,7 @@
 SetDictInt(A_DIM, A_DIM);
 SetDictInt(A_BOLD,A_BOLD);
 SetDictInt(A_ALTCHARSET,  A_ALTCHARSET);
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) || defined(HAVE_NCURSES_H)
 SetDictInt(A_INVIS,   A_INVIS);
 #endif
 SetDictInt(A_PROTECT, A_PROTECT);
@@ -2857,7 +2857,7 @@
 int key;
 char *key_n;
 char *key_n2;
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) || defined(HAVE_NCURSES_H)
 for (key=KEY_MIN;key  KEY_MAX; key++) {
 key_n = (char *)keyname(key);
 if (key_n == NULL || strcmp(key_n,UNKNOWN KEY)==0)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com