diff --git a/dev-lang/python/patches/python-2.7.6.patchset b/dev-lang/python/patches/python-2.7.6.patchset new file mode 100644 index 000000000..aaf1c963f --- /dev/null +++ b/dev-lang/python/patches/python-2.7.6.patchset @@ -0,0 +1,711 @@ +From b06b5f1a27ce987aba1de80599a8082065399dde Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Wed, 12 Mar 2014 21:17:06 +0000 +Subject: initial Haiku patch + + +diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py +index b9f1c6c..7be61d3 100644 +--- a/Lib/distutils/command/install.py ++++ b/Lib/distutils/command/install.py +@@ -83,6 +83,35 @@ INSTALL_SCHEMES = { + 'scripts': '$userbase/bin', + 'data' : '$userbase', + }, ++ 'haiku': { ++ 'purelib': '$base/non-packaged/lib/python$py_version_short/site-packages', ++ 'platlib': '$platbase/non-packaged/lib/python$py_version_short/site-packages', ++ 'headers': '$base/non-packaged/develop/headers/python$py_version_short/$dist_name', ++ 'scripts': '$base/non-packaged/bin', ++ 'data' : '$base/non-packaged', ++ }, ++ 'haiku_vendor': { ++ 'purelib': '$base/lib/python$py_version_short/vendor-packages', ++ 'platlib': '$platbase/lib/python$py_version_short/vendor-packages', ++ 'headers': '$base/develop/headers/python$py_version_short/$dist_name', ++ 'scripts': '$base/bin', ++ 'data' : '$base', ++ }, ++ 'haiku_home': { ++ 'purelib': '$base/lib/python', ++ 'platlib': '$base/lib/python', ++ 'headers': '$base/develop/headers/python/$dist_name', ++ 'scripts': '$base/bin', ++ 'data' : '$base', ++ }, ++ 'haiku_user': { ++ 'purelib': '$usersite', ++ 'platlib': '$usersite', ++ 'headers': '$userbase/develop/headers/python$py_version_short/$dist_name', ++ 'scripts': '$userbase/bin', ++ 'data' : '$userbase', ++ }, ++ + } + + # The keys to an installation scheme; if any new types of files are to be +@@ -416,10 +445,16 @@ class install (Command): + raise DistutilsPlatformError( + "User base directory is not specified") + self.install_base = self.install_platbase = self.install_userbase +- self.select_scheme("unix_user") ++ if sys.platform.startswith('haiku'): ++ self.select_scheme("haiku_user") ++ else: ++ self.select_scheme("unix_user") + elif self.home is not None: + self.install_base = self.install_platbase = self.home +- self.select_scheme("unix_home") ++ if sys.platform.startswith('haiku'): ++ self.select_scheme("haiku_home") ++ else: ++ self.select_scheme("unix_home") + else: + if self.prefix is None: + if self.exec_prefix is not None: +@@ -435,7 +470,13 @@ class install (Command): + + self.install_base = self.prefix + self.install_platbase = self.exec_prefix +- self.select_scheme("unix_prefix") ++ if sys.platform.startswith('haiku'): ++ if os.environ.get('HAIKU_USE_VENDOR_DIRECTORIES') == '1': ++ self.select_scheme("haiku_vendor") ++ else: ++ self.select_scheme("haiku") ++ else: ++ self.select_scheme("unix_prefix") + + # finalize_unix () + +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 4aa9334..d06e5e8 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -90,7 +90,8 @@ def get_python_inc(plat_specific=0, prefix=None): + # Include is located in the srcdir + inc_dir = os.path.join(srcdir, "Include") + return inc_dir +- return os.path.join(prefix, "include", "python" + get_python_version()) ++ inc_dir = "include" if sys.platform != "haiku1" else "develop/headers" ++ return os.path.join(prefix, inc_dir, "python" + get_python_version()) + elif os.name == "nt": + return os.path.join(prefix, "include") + elif os.name == "os2": +@@ -119,12 +120,20 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): + prefix = plat_specific and EXEC_PREFIX or PREFIX + + if os.name == "posix": +- libpython = os.path.join(prefix, +- "lib", "python" + get_python_version()) +- if standard_lib: +- return libpython ++ if sys.platform.startswith('haiku'): ++ if standard_lib: ++ return os.path.join(prefix, ++ "lib", "python" + get_python_version()) ++ return os.path.join(prefix, "non-packaged", ++ "lib", "python" + get_python_version(), ++ "site-packages") + else: +- return os.path.join(libpython, "site-packages") ++ libpython = os.path.join(prefix, ++ "lib", "python" + get_python_version()) ++ if standard_lib: ++ return libpython ++ else: ++ return os.path.join(libpython, "site-packages") + + elif os.name == "nt": + if standard_lib: +diff --git a/Lib/plat-haiku1/IN.py b/Lib/plat-haiku1/IN.py +new file mode 100644 +index 0000000..362cb41 +--- /dev/null ++++ b/Lib/plat-haiku1/IN.py +@@ -0,0 +1,327 @@ ++# Generated by h2py from /boot/develop/headers/be/net/netinet/in.h ++ ++# Included from socket.h ++ ++# Included from BeBuild.h ++B_BEOS_VERSION_4 = 0x0400 ++B_BEOS_VERSION_4_5 = 0x0450 ++B_BEOS_VERSION_5 = 0x0500 ++B_BEOS_VERSION = B_BEOS_VERSION_5 ++B_BEOS_VERSION_MAUI = B_BEOS_VERSION_5 ++_PR2_COMPATIBLE_ = 1 ++_PR3_COMPATIBLE_ = 1 ++_R4_COMPATIBLE_ = 1 ++_R4_5_COMPATIBLE_ = 1 ++_PR2_COMPATIBLE_ = 0 ++_PR3_COMPATIBLE_ = 0 ++_R4_COMPATIBLE_ = 1 ++_R4_5_COMPATIBLE_ = 1 ++def _UNUSED(x): return x ++ ++ ++# Included from sys/types.h ++ ++# Included from time.h ++ ++# Included from be_setup.h ++def __std(ref): return ref ++ ++__be_os = 2 ++__dest_os = __be_os ++__MSL__ = 0x4011 ++__GLIBC__ = -2 ++__GLIBC_MINOR__ = 1 ++ ++# Included from null.h ++NULL = (0) ++NULL = 0L ++ ++# Included from size_t.h ++ ++# Included from stddef.h ++ ++# Included from wchar_t.h ++CLOCKS_PER_SEC = 1000 ++CLK_TCK = CLOCKS_PER_SEC ++MAX_TIMESTR = 70 ++ ++# Included from sys/time.h ++ ++# Included from ByteOrder.h ++ ++# Included from endian.h ++__LITTLE_ENDIAN = 1234 ++LITTLE_ENDIAN = __LITTLE_ENDIAN ++__BYTE_ORDER = __LITTLE_ENDIAN ++BYTE_ORDER = __BYTE_ORDER ++__BIG_ENDIAN = 0 ++BIG_ENDIAN = 0 ++__BIG_ENDIAN = 4321 ++BIG_ENDIAN = __BIG_ENDIAN ++__BYTE_ORDER = __BIG_ENDIAN ++BYTE_ORDER = __BYTE_ORDER ++__LITTLE_ENDIAN = 0 ++LITTLE_ENDIAN = 0 ++__PDP_ENDIAN = 3412 ++PDP_ENDIAN = __PDP_ENDIAN ++ ++# Included from SupportDefs.h ++ ++# Included from Errors.h ++ ++# Included from limits.h ++ ++# Included from float.h ++FLT_ROUNDS = 1 ++FLT_RADIX = 2 ++FLT_MANT_DIG = 24 ++FLT_DIG = 6 ++FLT_MIN_EXP = (-125) ++FLT_MIN_10_EXP = (-37) ++FLT_MAX_EXP = 128 ++FLT_MAX_10_EXP = 38 ++DBL_MANT_DIG = 53 ++DBL_DIG = 15 ++DBL_MIN_EXP = (-1021) ++DBL_MIN_10_EXP = (-308) ++DBL_MAX_EXP = 1024 ++DBL_MAX_10_EXP = 308 ++LDBL_MANT_DIG = DBL_MANT_DIG ++LDBL_DIG = DBL_DIG ++LDBL_MIN_EXP = DBL_MIN_EXP ++LDBL_MIN_10_EXP = DBL_MIN_10_EXP ++LDBL_MAX_EXP = DBL_MAX_EXP ++LDBL_MAX_10_EXP = DBL_MAX_10_EXP ++CHAR_BIT = (8) ++SCHAR_MIN = (-127-1) ++SCHAR_MAX = (127) ++CHAR_MIN = SCHAR_MIN ++CHAR_MAX = SCHAR_MAX ++MB_LEN_MAX = (1) ++SHRT_MIN = (-32767-1) ++SHRT_MAX = (32767) ++LONG_MIN = (-2147483647L-1) ++LONG_MAX = (2147483647L) ++INT_MIN = LONG_MIN ++INT_MAX = LONG_MAX ++ARG_MAX = (32768) ++ATEXIT_MAX = (32) ++CHILD_MAX = (1024) ++IOV_MAX = (256) ++FILESIZEBITS = (64) ++LINK_MAX = (1) ++LOGIN_NAME_MAX = (32) ++MAX_CANON = (255) ++MAX_INPUT = (255) ++NAME_MAX = (256) ++NGROUPS_MAX = (32) ++OPEN_MAX = (128) ++PATH_MAX = (1024) ++PIPE_MAX = (512) ++SSIZE_MAX = (2147483647L) ++TTY_NAME_MAX = (256) ++TZNAME_MAX = (32) ++SYMLINKS_MAX = (16) ++_POSIX_ARG_MAX = (32768) ++_POSIX_CHILD_MAX = (1024) ++_POSIX_LINK_MAX = (1) ++_POSIX_LOGIN_NAME_MAX = (9) ++_POSIX_MAX_CANON = (255) ++_POSIX_MAX_INPUT = (255) ++_POSIX_NAME_MAX = (255) ++_POSIX_NGROUPS_MAX = (0) ++_POSIX_OPEN_MAX = (128) ++_POSIX_PATH_MAX = (1024) ++_POSIX_PIPE_BUF = (512) ++_POSIX_SSIZE_MAX = (2147483647L) ++_POSIX_STREAM_MAX = (8) ++_POSIX_TTY_NAME_MAX = (256) ++_POSIX_TZNAME_MAX = (3) ++B_GENERAL_ERROR_BASE = LONG_MIN ++B_OS_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x1000 ++B_APP_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x2000 ++B_INTERFACE_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x3000 ++B_MEDIA_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x4000 ++B_TRANSLATION_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x4800 ++B_MIDI_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x5000 ++B_STORAGE_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x6000 ++B_POSIX_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x7000 ++B_MAIL_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x8000 ++B_PRINT_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x9000 ++B_DEVICE_ERROR_BASE = B_GENERAL_ERROR_BASE + 0xa000 ++B_ERRORS_END = (B_GENERAL_ERROR_BASE + 0xffff) ++E2BIG = (B_POSIX_ERROR_BASE + 1) ++ECHILD = (B_POSIX_ERROR_BASE + 2) ++EDEADLK = (B_POSIX_ERROR_BASE + 3) ++EFBIG = (B_POSIX_ERROR_BASE + 4) ++EMLINK = (B_POSIX_ERROR_BASE + 5) ++ENFILE = (B_POSIX_ERROR_BASE + 6) ++ENODEV = (B_POSIX_ERROR_BASE + 7) ++ENOLCK = (B_POSIX_ERROR_BASE + 8) ++ENOSYS = (B_POSIX_ERROR_BASE + 9) ++ENOTTY = (B_POSIX_ERROR_BASE + 10) ++ENXIO = (B_POSIX_ERROR_BASE + 11) ++ESPIPE = (B_POSIX_ERROR_BASE + 12) ++ESRCH = (B_POSIX_ERROR_BASE + 13) ++EFPOS = (B_POSIX_ERROR_BASE + 14) ++ESIGPARM = (B_POSIX_ERROR_BASE + 15) ++EDOM = (B_POSIX_ERROR_BASE + 16) ++ERANGE = (B_POSIX_ERROR_BASE + 17) ++EPROTOTYPE = (B_POSIX_ERROR_BASE + 18) ++EPROTONOSUPPORT = (B_POSIX_ERROR_BASE + 19) ++EPFNOSUPPORT = (B_POSIX_ERROR_BASE + 20) ++EAFNOSUPPORT = (B_POSIX_ERROR_BASE + 21) ++EADDRINUSE = (B_POSIX_ERROR_BASE + 22) ++EADDRNOTAVAIL = (B_POSIX_ERROR_BASE + 23) ++ENETDOWN = (B_POSIX_ERROR_BASE + 24) ++ENETUNREACH = (B_POSIX_ERROR_BASE + 25) ++ENETRESET = (B_POSIX_ERROR_BASE + 26) ++ECONNABORTED = (B_POSIX_ERROR_BASE + 27) ++ECONNRESET = (B_POSIX_ERROR_BASE + 28) ++EISCONN = (B_POSIX_ERROR_BASE + 29) ++ENOTCONN = (B_POSIX_ERROR_BASE + 30) ++ESHUTDOWN = (B_POSIX_ERROR_BASE + 31) ++ECONNREFUSED = (B_POSIX_ERROR_BASE + 32) ++EHOSTUNREACH = (B_POSIX_ERROR_BASE + 33) ++ENOPROTOOPT = (B_POSIX_ERROR_BASE + 34) ++ENOBUFS = (B_POSIX_ERROR_BASE + 35) ++EINPROGRESS = (B_POSIX_ERROR_BASE + 36) ++EALREADY = (B_POSIX_ERROR_BASE + 37) ++EILSEQ = (B_POSIX_ERROR_BASE + 38) ++ENOMSG = (B_POSIX_ERROR_BASE + 39) ++ESTALE = (B_POSIX_ERROR_BASE + 40) ++EOVERFLOW = (B_POSIX_ERROR_BASE + 41) ++EMSGSIZE = (B_POSIX_ERROR_BASE + 42) ++EOPNOTSUPP = (B_POSIX_ERROR_BASE + 43) ++ENOTSOCK = (B_POSIX_ERROR_BASE + 44) ++false = 0 ++true = 1 ++NULL = (0) ++FALSE = 0 ++TRUE = 1 ++ ++# Included from TypeConstants.h ++B_HOST_IS_LENDIAN = 1 ++B_HOST_IS_BENDIAN = 0 ++def B_HOST_TO_LENDIAN_DOUBLE(arg): return (double)(arg) ++ ++def B_HOST_TO_LENDIAN_FLOAT(arg): return (float)(arg) ++ ++def B_HOST_TO_LENDIAN_INT64(arg): return (uint64)(arg) ++ ++def B_HOST_TO_LENDIAN_INT32(arg): return (uint32)(arg) ++ ++def B_HOST_TO_LENDIAN_INT16(arg): return (uint16)(arg) ++ ++def B_HOST_TO_BENDIAN_DOUBLE(arg): return __swap_double(arg) ++ ++def B_HOST_TO_BENDIAN_FLOAT(arg): return __swap_float(arg) ++ ++def B_HOST_TO_BENDIAN_INT64(arg): return __swap_int64(arg) ++ ++def B_HOST_TO_BENDIAN_INT32(arg): return __swap_int32(arg) ++ ++def B_HOST_TO_BENDIAN_INT16(arg): return __swap_int16(arg) ++ ++def B_LENDIAN_TO_HOST_DOUBLE(arg): return (double)(arg) ++ ++def B_LENDIAN_TO_HOST_FLOAT(arg): return (float)(arg) ++ ++def B_LENDIAN_TO_HOST_INT64(arg): return (uint64)(arg) ++ ++def B_LENDIAN_TO_HOST_INT32(arg): return (uint32)(arg) ++ ++def B_LENDIAN_TO_HOST_INT16(arg): return (uint16)(arg) ++ ++def B_BENDIAN_TO_HOST_DOUBLE(arg): return __swap_double(arg) ++ ++def B_BENDIAN_TO_HOST_FLOAT(arg): return __swap_float(arg) ++ ++def B_BENDIAN_TO_HOST_INT64(arg): return __swap_int64(arg) ++ ++def B_BENDIAN_TO_HOST_INT32(arg): return __swap_int32(arg) ++ ++def B_BENDIAN_TO_HOST_INT16(arg): return __swap_int16(arg) ++ ++B_HOST_IS_LENDIAN = 0 ++B_HOST_IS_BENDIAN = 1 ++def B_HOST_TO_LENDIAN_DOUBLE(arg): return __swap_double(arg) ++ ++def B_HOST_TO_LENDIAN_FLOAT(arg): return __swap_float(arg) ++ ++def B_HOST_TO_LENDIAN_INT64(arg): return __swap_int64(arg) ++ ++def B_HOST_TO_LENDIAN_INT32(arg): return __swap_int32(arg) ++ ++def B_HOST_TO_LENDIAN_INT16(arg): return __swap_int16(arg) ++ ++def B_HOST_TO_BENDIAN_DOUBLE(arg): return (double)(arg) ++ ++def B_HOST_TO_BENDIAN_FLOAT(arg): return (float)(arg) ++ ++def B_HOST_TO_BENDIAN_INT64(arg): return (uint64)(arg) ++ ++def B_HOST_TO_BENDIAN_INT32(arg): return (uint32)(arg) ++ ++def B_HOST_TO_BENDIAN_INT16(arg): return (uint16)(arg) ++ ++def B_LENDIAN_TO_HOST_DOUBLE(arg): return __swap_double(arg) ++ ++def B_LENDIAN_TO_HOST_FLOAT(arg): return __swap_float(arg) ++ ++def B_LENDIAN_TO_HOST_INT64(arg): return __swap_int64(arg) ++ ++def B_LENDIAN_TO_HOST_INT32(arg): return __swap_int32(arg) ++ ++def B_LENDIAN_TO_HOST_INT16(arg): return __swap_int16(arg) ++ ++def B_BENDIAN_TO_HOST_DOUBLE(arg): return (double)(arg) ++ ++def B_BENDIAN_TO_HOST_FLOAT(arg): return (float)(arg) ++ ++def B_BENDIAN_TO_HOST_INT64(arg): return (uint64)(arg) ++ ++def B_BENDIAN_TO_HOST_INT32(arg): return (uint32)(arg) ++ ++def B_BENDIAN_TO_HOST_INT16(arg): return (uint16)(arg) ++ ++def B_SWAP_DOUBLE(arg): return __swap_double(arg) ++ ++def B_SWAP_FLOAT(arg): return __swap_float(arg) ++ ++def B_SWAP_INT64(arg): return __swap_int64(arg) ++ ++def B_SWAP_INT32(arg): return __swap_int32(arg) ++ ++def B_SWAP_INT16(arg): return __swap_int16(arg) ++ ++def htonl(x): return B_HOST_TO_BENDIAN_INT32(x) ++ ++def ntohl(x): return B_BENDIAN_TO_HOST_INT32(x) ++ ++def htons(x): return B_HOST_TO_BENDIAN_INT16(x) ++ ++def ntohs(x): return B_BENDIAN_TO_HOST_INT16(x) ++ ++AF_INET = 1 ++INADDR_ANY = 0x00000000 ++INADDR_BROADCAST = 0xffffffff ++INADDR_LOOPBACK = 0x7f000001 ++SOL_SOCKET = 1 ++SO_DEBUG = 1 ++SO_REUSEADDR = 2 ++SO_NONBLOCK = 3 ++SO_REUSEPORT = 4 ++MSG_OOB = 0x1 ++SOCK_DGRAM = 1 ++SOCK_STREAM = 2 ++IPPROTO_UDP = 1 ++IPPROTO_TCP = 2 ++IPPROTO_ICMP = 3 ++B_UDP_MAX_SIZE = (65536 - 1024) ++FD_SETSIZE = 256 ++FDSETSIZE = FD_SETSIZE ++NFDBITS = 32 ++def _FDMSKNO(fd): return ((fd) / NFDBITS) ++ ++def _FDBITNO(fd): return ((fd) % NFDBITS) +diff --git a/Lib/plat-haiku1/regen b/Lib/plat-haiku1/regen +new file mode 100644 +index 0000000..d9da80c +--- /dev/null ++++ b/Lib/plat-haiku1/regen +@@ -0,0 +1,7 @@ ++#! /bin/sh ++ ++H2PY=../../Tools/scripts/h2py.py ++HEADERS=/boot/develop/headers ++ ++set -v ++python $H2PY -i '(u_long)' $HEADERS/posix/netinet/in.h +diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py +index e7955cc..703ddf6 100644 +--- a/Lib/test/test_fileio.py ++++ b/Lib/test/test_fileio.py +@@ -297,6 +297,7 @@ class OtherFileTests(unittest.TestCase): + self.assertEqual(f.writable(), True) + if sys.platform != "darwin" and \ + 'bsd' not in sys.platform and \ ++ 'haiku' not in sys.platform and \ + not sys.platform.startswith('sunos'): + # Somehow /dev/tty appears seekable on some BSDs + self.assertEqual(f.seekable(), False) +diff --git a/Modules/resource.c b/Modules/resource.c +index 53a6c3e..6c5f52f 100644 +--- a/Modules/resource.c ++++ b/Modules/resource.c +@@ -86,6 +86,7 @@ resource_getrusage(PyObject *self, PyObject *args) + 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 @@ resource_getrusage(PyObject *self, PyObject *args) + 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 --git a/Modules/socketmodule.c b/Modules/socketmodule.c +index 2735ecc..fb01c63 100644 +--- a/Modules/socketmodule.c ++++ b/Modules/socketmodule.c +@@ -4865,7 +4865,9 @@ init_socket(void) + #ifndef __BEOS__ + /* We have incomplete socket support. */ + PyModule_AddIntConstant(m, "SOCK_RAW", SOCK_RAW); ++#ifndef __HAIKU__ + PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET); ++#endif + #if defined(SOCK_RDM) + PyModule_AddIntConstant(m, "SOCK_RDM", SOCK_RDM); + #endif +diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h +index 8515499..4e33e4f 100644 +--- a/Modules/socketmodule.h ++++ b/Modules/socketmodule.h +@@ -47,6 +47,10 @@ typedef int socklen_t; + # undef AF_NETLINK + #endif + ++#if defined(__HAIKU__) ++#undef HAVE_BLUETOOTH_BLUETOOTH_H ++#endif ++ + #ifdef HAVE_BLUETOOTH_BLUETOOTH_H + #include + #include +diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c +index 957de58..69be5bb 100644 +--- a/Modules/spwdmodule.c ++++ b/Modules/spwdmodule.c +@@ -79,7 +79,9 @@ static PyObject *mkspent(struct spwd *p) + + 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 --git a/Modules/timemodule.c b/Modules/timemodule.c +index 12c43b0..206b325 100644 +--- a/Modules/timemodule.c ++++ b/Modules/timemodule.c +@@ -1006,11 +1006,11 @@ floatsleep(double secs) + 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 --git a/Python/bltinmodule.c b/Python/bltinmodule.c +index d22dca2..9a5d561 100644 +--- a/Python/bltinmodule.c ++++ b/Python/bltinmodule.c +@@ -19,7 +19,7 @@ + */ + #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) + const char *Py_FileSystemDefaultEncoding = "mbcs"; +-#elif defined(__APPLE__) ++#elif defined(__APPLE__) || defined(__HAIKU__) + const char *Py_FileSystemDefaultEncoding = "utf-8"; + #else + const char *Py_FileSystemDefaultEncoding = NULL; /* use default */ +diff --git a/Tools/scripts/h2py.py b/Tools/scripts/h2py.py +index c64501e..7df3ad7 100755 +--- a/Tools/scripts/h2py.py ++++ b/Tools/scripts/h2py.py +@@ -50,7 +50,7 @@ except KeyError: + 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 --git a/configure.ac b/configure.ac +index 891d568..24959b3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -883,7 +883,7 @@ if test $enable_shared = "yes"; then + RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} + INSTSONAME="$LDLIBRARY".$SOVERSION + ;; +- Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*) ++ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|Haiku*) + LDLIBRARY='libpython$(VERSION).so' + BLDLIBRARY='-L. -lpython$(VERSION)' + RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} +@@ -891,6 +891,9 @@ if test $enable_shared = "yes"; then + FreeBSD*) + SOVERSION=`echo $SOVERSION|cut -d "." -f 1` + ;; ++ Haiku*) ++ RUNSHARED=LIBRARY_PATH=`pwd`:${LIBRARY_PATH} ++ ;; + esac + INSTSONAME="$LDLIBRARY".$SOVERSION + ;; +@@ -1006,7 +1009,7 @@ AC_PROG_MKDIR_P + 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;; +@@ -2024,7 +2027,7 @@ then + fi + fi + ;; +- Linux*|GNU*|QNX*) ++ Linux*|GNU*|QNX*|Haiku*) + LDSHARED='$(CC) -shared' + LDCXXSHARED='$(CXX) -shared';; + BSD/OS*/4*) +@@ -2096,7 +2099,7 @@ then + then CCSHARED="-fPIC"; + else CCSHARED="+z"; + fi;; +- Linux*|GNU*) CCSHARED="-fPIC";; ++ Linux*|GNU*|Haiku*) CCSHARED="-fPIC";; + BSD/OS*/4*) CCSHARED="-fpic";; + FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; + OpenUNIX*|UnixWare*) +@@ -2128,7 +2131,7 @@ then + LINKFORSHARED="-Wl,-E -Wl,+s";; + # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; + BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; +- Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; ++ Linux*|GNU*|Haiku*) LINKFORSHARED="-Xlinker -export-dynamic";; + # -u libsys_s pulls in all symbols in libsys + Darwin/*) + # -u _PyMac_Error is needed to pull in the mac toolbox glue, +@@ -2243,14 +2246,16 @@ case "$ac_sys_system" in + esac + + # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. +-# BeOS' sockets are stashed in libnet. + AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 + AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets + ++# BeOS' sockets are stashed in libnet. ++# Haiku's sockets are stashed in libnetwork. + case "$ac_sys_system" in +-BeOS*) +-AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS +-;; ++ BeOS*) ++ AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS);; ++ Haiku*) ++ AC_CHECK_LIB(network, socket, [LIBS="-lnetwork $LIBS"], [], $LIBS);; + esac + + AC_MSG_CHECKING(for --with-libs) +@@ -3586,7 +3591,7 @@ fi], + AC_SUBST(LIBM) + case $ac_sys_system in + Darwin) ;; +-BeOS) ;; ++BeOS|Haiku) ;; + *) LIBM=-lm + esac + AC_MSG_CHECKING(for --with-libm=STRING) +diff --git a/setup.py b/setup.py +index 40ad843..5ea9c94 100644 +--- a/setup.py ++++ b/setup.py +@@ -523,6 +523,11 @@ class PyBuildExt(build_ext): + lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep) + inc_dirs += ['/system/include', '/atheos/autolnk/include'] + inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) ++ ++ # Haiku-specific include and library locations ++ if host_platform == 'haiku1': ++ inc_dirs += ['/boot/develop/headers/posix', '/boot/develop/headers/3rdparty'] ++ lib_dirs += ['/boot/system/lib', '/boot/develop/lib/x86'] + + # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) + if host_platform in ['osf1', 'unixware7', 'openunix8']: +@@ -551,7 +556,7 @@ class PyBuildExt(build_ext): + + # Check for MacOS X, which doesn't need libm.a at all + math_libs = ['m'] +- if host_platform in ['darwin', 'beos']: ++ if host_platform in ['darwin', 'beos', 'haiku1']: + math_libs = [] + + # XXX Omitted modules: gl, pure, dl, SGI-specific modules +@@ -1324,7 +1329,7 @@ class PyBuildExt(build_ext): + missing.append('resource') + + # Sun yellow pages. Some systems have the functions in libc. +- if (host_platform not in ['cygwin', 'atheos', 'qnx6'] and ++ if (host_platform not in ['cygwin', 'atheos', 'qnx6', 'haiku1'] and + find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None): + if (self.compiler.find_library_file(lib_dirs, 'nsl')): + libs = ['nsl'] +-- +1.8.3.4 + diff --git a/dev-lang/python/python-2.7.6.recipe b/dev-lang/python/python-2.7.6.recipe new file mode 100644 index 000000000..ef16ae4cc --- /dev/null +++ b/dev-lang/python/python-2.7.6.recipe @@ -0,0 +1,110 @@ +SUMMARY="An interpreted, interactive, object-oriented programming language" +DESCRIPTION=" +Python is a programming language that lets you work more quickly and integrate \ +your systems more effectively. You can learn to use Python and see almost \ +immediate gains in productivity and lower maintenance costs. +Python runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java \ +and .NET virtual machines. +Python is free to use, even for commercial products, because of its \ +OSI-approved open source license. +" +HOMEPAGE="http://www.python.org" +LICENSE="Python" +COPYRIGHT="1990-2012, Python Software Foundation" +SRC_URI="http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz" +CHECKSUM_MD5="bcf93efa8eaf383c98ed3ce40b763497" +REVISION="1" +ARCHITECTURES="?x86_gcc2 ?x86 ?x86_64" + +PATCHES="python-2.7.6.patchset" + +PROVIDES=" + python = $portVersion compat >= 2.7 + cmd:2to3 = $portVersion compat >= 2.7 + cmd:idle = $portVersion compat >= 2.7 + cmd:pydoc = $portVersion compat >= 2.7 + cmd:python = $portVersion compat >= 2.7 + cmd:python2.7 = $portVersion compat >= 2.7 + cmd:python2.7_config = $portVersion compat >= 2.7 + cmd:python_config = $portVersion compat >= 2.7 + cmd:smtpd.py = $portVersion compat >= 2.7 + devel:libpython2.7 = 1.0 + lib:libpython2.7 = 1.0 + " +REQUIRES=" + haiku >= $haikuVersion + cmd:nano + lib:libbz2 + lib:libncurses + lib:libssl + lib:libreadline + lib:libsqlite3 + lib:libz + " +BUILD_REQUIRES=" + devel:libbz2 + devel:libncurses + devel:libssl + devel:libreadline + devel:libsqlite3 + devel:libz + " +BUILD_PREREQUIRES=" + haiku_devel >= $haikuVersion + cmd:aclocal + cmd:autoconf + cmd:find + cmd:gcc + cmd:ld + cmd:libtoolize + cmd:make + cmd:nano + " + +SOURCE_DIR="Python-2.7.6" + +GLOBAL_WRITABLE_FILES=" + non-packaged/lib/python2.7/site-packages directory keep-old + " + +BUILD() +{ + cd Modules/_ctypes/libffi + libtoolize --force --copy --install + cd ../../.. + + libtoolize --force --copy --install + aclocal + autoconf + runConfigure ./configure \ + --enable-shared \ + --enable-unicode=ucs4 + + # prevent make from rebuilding stuff that requires python + touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h + + make $jobArgs +} + +INSTALL() +{ + make install + + prepareInstalledDevelLibs libpython2.7 + + mkdir -p $prefix/lib/python2.7/vendor-packages + echo 'This directory contains packaged python modules.' \ + >$prefix/lib/python2.7/vendor-packages/README + + mkdir -p $prefix/non-packaged/lib/python2.7 + mv $prefix/lib/python2.7/site-packages $prefix/non-packaged/lib/python2.7/ +} + +TEST() +{ + cd Lib/test + rm test_asynchat.py # this one stalls, so skip it for now + rm test_multiprocessing.py # this one stalls, so skip it for now + + python regrtest.py +}