Files
haikuports/dev-lang/python/python-2.5.4-haiku.diff

316 lines
10 KiB
Diff

diff -urN Python-2.5.4/Lib/test/regrtest.py Python-2.5.4-haiku/Lib/test/regrtest.py
--- Python-2.5.4/Lib/test/regrtest.py 2009-01-02 15:47:37.000000000 +0000
+++ Python-2.5.4-haiku/Lib/test/regrtest.py 2009-01-03 04:18:40.000000000 +0000
@@ -846,6 +846,42 @@
test_wait3
test_wait4
""",
+ 'haiku1':
+ """
+ test_al
+ test_applesingle
+ test_bsddb
+ test_bsddb185
+ test_bsddb3
+ test_cd
+ test_cl
+ test_codecmaps_cn
+ test_codecmaps_hk
+ test_codecmaps_jp
+ test_codecmaps_kr
+ test_codecmaps_tw
+ test_curses
+ test_dbm
+ test_dl
+ test_gl
+ test_gdbm
+ test_imgfile
+ test_linuxaudiodev
+ test__locale
+ test_gl
+ test_macfs
+ test_macostools
+ test_mailbox
+ test_nis
+ test_normalization
+ test_old_mailbox
+ test_ossaudiodev
+ test_pep277
+ test_plistlib
+ test_resource
+ test_startfile
+ test_sunaudiodev
+ """,
'linux2':
"""
test_al
diff -urN Python-2.5.4/Modules/resource.c Python-2.5.4-haiku/Modules/resource.c
--- Python-2.5.4/Modules/resource.c 2009-01-02 15:46:32.000000000 +0000
+++ Python-2.5.4-haiku/Modules/resource.c 2009-01-02 15:49:40.000000000 +0000
@@ -86,6 +86,7 @@
PyFloat_FromDouble(doubletime(ru.ru_utime)));
PyStructSequence_SET_ITEM(result, 1,
PyFloat_FromDouble(doubletime(ru.ru_stime)));
+#ifndef __HAIKU__
PyStructSequence_SET_ITEM(result, 2, PyInt_FromLong(ru.ru_maxrss));
PyStructSequence_SET_ITEM(result, 3, PyInt_FromLong(ru.ru_ixrss));
PyStructSequence_SET_ITEM(result, 4, PyInt_FromLong(ru.ru_idrss));
@@ -100,6 +101,7 @@
PyStructSequence_SET_ITEM(result, 13, PyInt_FromLong(ru.ru_nsignals));
PyStructSequence_SET_ITEM(result, 14, PyInt_FromLong(ru.ru_nvcsw));
PyStructSequence_SET_ITEM(result, 15, PyInt_FromLong(ru.ru_nivcsw));
+#endif
if (PyErr_Occurred()) {
Py_DECREF(result);
diff -urN Python-2.5.4/Modules/selectmodule.c Python-2.5.4-haiku/Modules/selectmodule.c
--- Python-2.5.4/Modules/selectmodule.c 2009-01-02 15:46:32.000000000 +0000
+++ Python-2.5.4-haiku/Modules/selectmodule.c 2009-01-02 15:49:40.000000000 +0000
@@ -49,7 +49,7 @@
# include <winsock.h>
#else
# define SOCKET int
-# ifdef __BEOS__
+# if defined(__BEOS__) && !defined(__HAIKU__)
# include <net/socket.h>
# elif defined(__VMS)
# include <socket.h>
diff -urN Python-2.5.4/Modules/socketmodule.c Python-2.5.4-haiku/Modules/socketmodule.c
--- Python-2.5.4/Modules/socketmodule.c 2009-01-02 15:46:31.000000000 +0000
+++ Python-2.5.4-haiku/Modules/socketmodule.c 2009-01-02 15:49:40.000000000 +0000
@@ -244,7 +244,7 @@
# include <netdb.h>
/* Headers needed for inet_ntoa() and inet_addr() */
-# ifdef __BEOS__
+# if defined(__BEOS__) && !defined(__HAIKU__)
# include <net/netdb.h>
# elif defined(PYOS_OS2) && defined(PYCC_VACPP)
# include <netdb.h>
@@ -336,7 +336,7 @@
#include "getnameinfo.c"
#endif
-#if defined(MS_WINDOWS) || defined(__BEOS__)
+#if defined(MS_WINDOWS) || (defined(__BEOS__) && !defined(__HAIKU__))
/* BeOS suffers from the same socket dichotomy as Win32... - [cjh] */
/* seem to be a few differences in the API */
#define SOCKETCLOSE closesocket
@@ -667,7 +667,7 @@
#endif
Py_BEGIN_ALLOW_THREADS
-#ifdef __BEOS__
+#if defined(__BEOS__) && !defined(__HAIKU__)
block = !block;
setsockopt(s->sock_fd, SOL_SOCKET, SO_NONBLOCK,
(void *)(&block), sizeof(int));
@@ -696,7 +696,7 @@
block = !block;
socketioctl(s->sock_fd, FIONBIO, (u_long*)&block);
#endif /* RISCOS */
-#endif /* __BEOS__ */
+#endif /* defined(__BEOS__) && !defined(__HAIKU__) */
Py_END_ALLOW_THREADS
/* Since these don't return anything */
@@ -1021,7 +1021,7 @@
return Py_None;
}
-#ifdef __BEOS__
+#if defined(__BEOS__) && !defined(__HAIKU__)
/* XXX: BeOS version of accept() doesn't set family correctly */
addr->sa_family = AF_INET;
#endif
@@ -1756,7 +1756,7 @@
PyObject *buf;
socklen_t buflen = 0;
-#ifdef __BEOS__
+#if defined(__BEOS__) && !defined(__HAIKU__)
/* We have incomplete socket support. */
PyErr_SetString(socket_error, "getsockopt not supported");
return NULL;
@@ -1797,7 +1797,7 @@
}
_PyString_Resize(&buf, buflen);
return buf;
-#endif /* __BEOS__ */
+#endif /* defined(__BEOS__) && !defined(__HAIKU__) */
}
PyDoc_STRVAR(getsockopt_doc,
@@ -3354,7 +3354,7 @@
{
char *name;
struct protoent *sp;
-#ifdef __BEOS__
+#if defined(__BEOS__) && !defined(__HAIKU__)
/* Not available in BeOS yet. - [cjh] */
PyErr_SetString(socket_error, "getprotobyname not supported");
return NULL;
@@ -4440,7 +4440,7 @@
/* Socket types */
PyModule_AddIntConstant(m, "SOCK_STREAM", SOCK_STREAM);
PyModule_AddIntConstant(m, "SOCK_DGRAM", SOCK_DGRAM);
-#ifndef __BEOS__
+#if defined(__BEOS__) && !defined(__HAIKU__)
/* We have incomplete socket support. */
PyModule_AddIntConstant(m, "SOCK_RAW", SOCK_RAW);
PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET);
diff -urN Python-2.5.4/Modules/socketmodule.h Python-2.5.4-haiku/Modules/socketmodule.h
--- Python-2.5.4/Modules/socketmodule.h 2009-01-02 15:46:31.000000000 +0000
+++ Python-2.5.4-haiku/Modules/socketmodule.h 2009-01-02 15:49:40.000000000 +0000
@@ -41,6 +41,10 @@
# undef AF_NETLINK
#endif
+#if defined(__HAIKU__)
+#undef HAVE_BLUETOOTH_BLUETOOTH_H
+#endif
+
#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>
diff -urN Python-2.5.4/Modules/spwdmodule.c Python-2.5.4-haiku/Modules/spwdmodule.c
--- Python-2.5.4/Modules/spwdmodule.c 2009-01-02 15:46:31.000000000 +0000
+++ Python-2.5.4-haiku/Modules/spwdmodule.c 2009-01-02 15:49:40.000000000 +0000
@@ -79,7 +79,9 @@
SETS(setIndex++, p->sp_namp);
SETS(setIndex++, p->sp_pwdp);
+#ifndef __HAIKU__
SETI(setIndex++, p->sp_lstchg);
+#endif
SETI(setIndex++, p->sp_min);
SETI(setIndex++, p->sp_max);
SETI(setIndex++, p->sp_warn);
diff -urN Python-2.5.4/Modules/timemodule.c Python-2.5.4-haiku/Modules/timemodule.c
--- Python-2.5.4/Modules/timemodule.c 2009-01-02 15:46:32.000000000 +0000
+++ Python-2.5.4-haiku/Modules/timemodule.c 2009-01-02 15:49:40.000000000 +0000
@@ -968,11 +968,11 @@
return -1;
}
Py_END_ALLOW_THREADS
-#elif defined(__BEOS__)
+#elif defined(__BEOS__) || defined(__HAIKU__)
/* This sleep *CAN BE* interrupted. */
{
if( secs <= 0.0 ) {
- return;
+ return 0;
}
Py_BEGIN_ALLOW_THREADS
diff -urN Python-2.5.4/Parser/asdl_c.py Python-2.5.4-haiku/Parser/asdl_c.py
--- Python-2.5.4/Parser/asdl_c.py 2009-01-02 15:47:18.000000000 +0000
+++ Python-2.5.4-haiku/Parser/asdl_c.py 2009-01-02 16:12:00.000000000 +0000
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /bin/env python
"""Generate C code from an ASDL description."""
# TO DO
diff -urN Python-2.5.4/Tools/scripts/h2py.py Python-2.5.4-haiku/Tools/scripts/h2py.py
--- Python-2.5.4/Tools/scripts/h2py.py 2009-01-02 15:46:48.000000000 +0000
+++ Python-2.5.4-haiku/Tools/scripts/h2py.py 2009-01-02 16:24:00.000000000 +0000
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /bin/env python
# Read #define's and translate to Python code.
# Handle #include statements.
@@ -50,7 +50,7 @@
searchdirs=os.environ['INCLUDE'].split(';')
except KeyError:
try:
- if sys.platform.find("beos") == 0:
+ if sys.platform.find("beos") == 0 or sys.platform.find("haiku1") == 0:
searchdirs=os.environ['BEINCLUDES'].split(';')
elif sys.platform.startswith("atheos"):
searchdirs=os.environ['C_INCLUDE_PATH'].split(':')
diff -urN Python-2.5.4/configure.in Python-2.5.4-haiku/configure.in
--- Python-2.5.4/configure.in 2009-01-02 15:47:18.000000000 +0000
+++ Python-2.5.4-haiku/configure.in 2009-01-02 15:49:40.000000000 +0000
@@ -627,6 +627,11 @@
BeOS*)
LDLIBRARY='libpython$(VERSION).so'
;;
+ Haiku*)
+ LDLIBRARY='libpython$(VERSION).so'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
+ RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
+ ;;
CYGWIN*)
LDLIBRARY='libpython$(VERSION).dll.a'
DLLLIBRARY='libpython$(VERSION).dll'
@@ -709,7 +714,7 @@
AC_SUBST(LN)
if test -z "$LN" ; then
case $ac_sys_system in
- BeOS*) LN="ln -s";;
+ BeOS*|Haiku*) LN="ln -s";;
CYGWIN*) LN="ln -s";;
atheos*) LN="ln -s";;
*) LN=ln;;
@@ -1445,6 +1450,10 @@
BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
;;
+ Haiku*)
+ LDFLAGS="-L." # help ld find libpythonX.Y.so in root directory
+ LDSHARED="gcc -shared"
+ ;;
IRIX/5*) LDSHARED="ld -shared";;
IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
SunOS/5*)
@@ -1585,6 +1594,7 @@
*) CCSHARED="";;
esac;;
atheos*) CCSHARED="-fPIC";;
+ Haiku*) CCSHARED="-fPIC";;
esac
fi
AC_MSG_RESULT($CCSHARED)
@@ -1710,6 +1720,9 @@
BeOS*)
AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
;;
+Haiku*)
+AC_CHECK_LIB(network, socket, [LIBS="-lnetwork $LIBS"], [], $LIBS) # Haiku
+;;
esac
AC_MSG_CHECKING(for --with-libs)
@@ -2879,7 +2892,7 @@
AC_SUBST(LIBM)
case $ac_sys_system in
Darwin) ;;
-BeOS) ;;
+BeOS|Haiku) ;;
*) LIBM=-lm
esac
AC_MSG_CHECKING(for --with-libm=STRING)
diff -urN Python-2.5.4/setup.py Python-2.5.4-haiku/setup.py
--- Python-2.5.4/setup.py 2009-01-02 15:47:18.000000000 +0000
+++ Python-2.5.4-haiku/setup.py 2009-01-02 15:49:40.000000000 +0000
@@ -338,7 +338,7 @@
# Check for MacOS X, which doesn't need libm.a at all
math_libs = ['m']
- if platform in ['darwin', 'beos', 'mac']:
+ if platform in ['darwin', 'beos', 'haiku1', 'mac']:
math_libs = []
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
@@ -912,7 +912,7 @@
exts.append( Extension('resource', ['resource.c']) )
# Sun yellow pages. Some systems have the functions in libc.
- if platform not in ['cygwin', 'atheos']:
+ if platform not in ['cygwin', 'atheos', 'haiku1']:
if (self.compiler.find_library_file(lib_dirs, 'nsl')):
libs = ['nsl']
else: