mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
Also: - consolidate recipe 'options' near the top. - remove pyvenv from provides (removed on Python 3.8).
1230 lines
44 KiB
Plaintext
1230 lines
44 KiB
Plaintext
From 2588bddbcbdbc66cd4cb6b209726143ff9e3ffd7 Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Thu, 25 Jul 2024 17:26:26 -0300
|
|
Subject: Initial Haiku patch (re-worked a bit).
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
This combines:
|
|
|
|
* The original "initial Haiku patch" from Jérôme Duval.
|
|
* A variation of Adrien Destugues changes in setup.py from his x86 patch.
|
|
|
|
Ideally, we can continue moving changes from here into "per topic" commits,
|
|
leaving here mostly only make/config related changes, for example.
|
|
|
|
diff --git a/Include/pyport.h b/Include/pyport.h
|
|
index 6ab0ae4..ad8c45c 100644
|
|
--- a/Include/pyport.h
|
|
+++ b/Include/pyport.h
|
|
@@ -850,7 +850,7 @@ extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler;
|
|
# define _Py_FORCE_UTF8_LOCALE
|
|
#endif
|
|
|
|
-#if defined(_Py_FORCE_UTF8_LOCALE) || defined(__APPLE__)
|
|
+#if defined(_Py_FORCE_UTF8_LOCALE) || defined(__APPLE__) || defined(__HAIKU__)
|
|
// Use UTF-8 as the filesystem encoding.
|
|
// See PyUnicode_DecodeFSDefaultAndSize(), PyUnicode_EncodeFSDefault(),
|
|
// Py_DecodeLocale() and Py_EncodeLocale().
|
|
diff --git a/Lib/plat-haiku1/regen b/Lib/plat-haiku1/regen
|
|
new file mode 100644
|
|
index 0000000..4372ee2
|
|
--- /dev/null
|
|
+++ b/Lib/plat-haiku1/regen
|
|
@@ -0,0 +1,4 @@
|
|
+#! /bin/sh
|
|
+HEADERS=/boot/develop/headers
|
|
+set -v
|
|
+eval $PYTHON_FOR_BUILD ../../Tools/scripts/h2py.py -i "'(u_long)'" $HEADERS/posix/netinet/in.h
|
|
diff --git a/Makefile.pre.in b/Makefile.pre.in
|
|
index fa99dd8..c898c9f 100644
|
|
--- a/Makefile.pre.in
|
|
+++ b/Makefile.pre.in
|
|
@@ -141,7 +141,7 @@ BINDIR= @bindir@
|
|
LIBDIR= @libdir@
|
|
MANDIR= @mandir@
|
|
INCLUDEDIR= @includedir@
|
|
-CONFINCLUDEDIR= $(exec_prefix)/include
|
|
+CONFINCLUDEDIR= $(INCLUDEDIR)
|
|
PLATLIBDIR= @PLATLIBDIR@
|
|
SCRIPTDIR= $(prefix)/$(PLATLIBDIR)
|
|
ABIFLAGS= @ABIFLAGS@
|
|
diff --git a/Modules/resource.c b/Modules/resource.c
|
|
index 0d69c29..02f692d 100644
|
|
--- a/Modules/resource.c
|
|
+++ b/Modules/resource.c
|
|
@@ -112,6 +112,7 @@ resource_getrusage_impl(PyObject *module, int who)
|
|
PyFloat_FromDouble(doubletime(ru.ru_utime)));
|
|
PyStructSequence_SET_ITEM(result, 1,
|
|
PyFloat_FromDouble(doubletime(ru.ru_stime)));
|
|
+#ifndef __HAIKU__
|
|
PyStructSequence_SET_ITEM(result, 2, PyLong_FromLong(ru.ru_maxrss));
|
|
PyStructSequence_SET_ITEM(result, 3, PyLong_FromLong(ru.ru_ixrss));
|
|
PyStructSequence_SET_ITEM(result, 4, PyLong_FromLong(ru.ru_idrss));
|
|
@@ -126,7 +127,22 @@ resource_getrusage_impl(PyObject *module, int who)
|
|
PyStructSequence_SET_ITEM(result, 13, PyLong_FromLong(ru.ru_nsignals));
|
|
PyStructSequence_SET_ITEM(result, 14, PyLong_FromLong(ru.ru_nvcsw));
|
|
PyStructSequence_SET_ITEM(result, 15, PyLong_FromLong(ru.ru_nivcsw));
|
|
-
|
|
+#else
|
|
+ PyStructSequence_SET_ITEM(result, 2, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 3, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 4, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 5, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 6, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 7, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 8, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 9, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 10, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 11, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 12, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 13, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 14, PyLong_FromLong(0));
|
|
+ PyStructSequence_SET_ITEM(result, 15, PyLong_FromLong(0));
|
|
+#endif
|
|
if (PyErr_Occurred()) {
|
|
Py_DECREF(result);
|
|
return NULL;
|
|
@@ -376,19 +392,19 @@ resource_exec(PyObject *module)
|
|
}
|
|
|
|
/* insert constants */
|
|
-#ifdef RLIMIT_CPU
|
|
+#if !defined(__HAIKU__) && defined(RLIMIT_CPU)
|
|
ADD_INT(module, RLIMIT_CPU);
|
|
#endif
|
|
|
|
-#ifdef RLIMIT_FSIZE
|
|
+#if !defined(__HAIKU__) && defined(RLIMIT_FSIZE)
|
|
ADD_INT(module, RLIMIT_FSIZE);
|
|
#endif
|
|
|
|
-#ifdef RLIMIT_DATA
|
|
+#if !defined(__HAIKU__) && defined(RLIMIT_DATA)
|
|
ADD_INT(module, RLIMIT_DATA);
|
|
#endif
|
|
|
|
-#ifdef RLIMIT_STACK
|
|
+#if !defined(__HAIKU__) && defined(RLIMIT_STACK)
|
|
ADD_INT(module, RLIMIT_STACK);
|
|
#endif
|
|
|
|
@@ -400,31 +416,31 @@ resource_exec(PyObject *module)
|
|
ADD_INT(module, RLIMIT_NOFILE);
|
|
#endif
|
|
|
|
-#ifdef RLIMIT_OFILE
|
|
+#if !defined(__HAIKU__) && defined(RLIMIT_OFILE)
|
|
ADD_INT(module, RLIMIT_OFILE);
|
|
#endif
|
|
|
|
-#ifdef RLIMIT_VMEM
|
|
+#if !defined(__HAIKU__) && defined(RLIMIT_VMEM)
|
|
ADD_INT(module, RLIMIT_VMEM);
|
|
#endif
|
|
|
|
-#ifdef RLIMIT_AS
|
|
+#if !defined(__HAIKU__) && defined(RLIMIT_AS)
|
|
ADD_INT(module, RLIMIT_AS);
|
|
#endif
|
|
|
|
-#ifdef RLIMIT_RSS
|
|
+#if !defined(__HAIKU__) && defined(RLIMIT_RSS)
|
|
ADD_INT(module, RLIMIT_RSS);
|
|
#endif
|
|
|
|
-#ifdef RLIMIT_NPROC
|
|
+#if !defined(__HAIKU__) && defined(RLIMIT_NPROC)
|
|
ADD_INT(module, RLIMIT_NPROC);
|
|
#endif
|
|
|
|
-#ifdef RLIMIT_MEMLOCK
|
|
+#if !defined(__HAIKU__) && defined(RLIMIT_MEMLOCK)
|
|
ADD_INT(module, RLIMIT_MEMLOCK);
|
|
#endif
|
|
|
|
-#ifdef RLIMIT_SBSIZE
|
|
+#if !defined(__HAIKU__) && defined(RLIMIT_SBSIZE)
|
|
ADD_INT(module, RLIMIT_SBSIZE);
|
|
#endif
|
|
|
|
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
|
|
index be628a0..a4c555c 100644
|
|
--- a/Modules/socketmodule.c
|
|
+++ b/Modules/socketmodule.c
|
|
@@ -7483,7 +7483,9 @@ PyInit__socket(void)
|
|
/* SOCK_RAW is marked as optional in the POSIX specification */
|
|
PyModule_AddIntMacro(m, SOCK_RAW);
|
|
#endif
|
|
+#ifndef __HAIKU__
|
|
PyModule_AddIntMacro(m, SOCK_SEQPACKET);
|
|
+#endif
|
|
#if defined(SOCK_RDM)
|
|
PyModule_AddIntMacro(m, SOCK_RDM);
|
|
#endif
|
|
diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h
|
|
index e4f375d..ce1bc6b 100644
|
|
--- a/Modules/socketmodule.h
|
|
+++ b/Modules/socketmodule.h
|
|
@@ -104,6 +104,10 @@ typedef int socklen_t;
|
|
# undef AF_QIPCRTR
|
|
#endif
|
|
|
|
+#if defined(__HAIKU__)
|
|
+#undef HAVE_BLUETOOTH_BLUETOOTH_H
|
|
+#endif
|
|
+
|
|
#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
|
|
#include <bluetooth/bluetooth.h>
|
|
#include <bluetooth/rfcomm.h>
|
|
diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c
|
|
index acea306..050a3d0 100644
|
|
--- a/Modules/spwdmodule.c
|
|
+++ b/Modules/spwdmodule.c
|
|
@@ -9,6 +9,7 @@
|
|
#ifdef HAVE_SHADOW_H
|
|
#include <shadow.h>
|
|
#endif
|
|
+#include <errno.h>
|
|
|
|
#include "clinic/spwdmodule.c.h"
|
|
|
|
@@ -148,7 +149,12 @@ spwd_getspnam_impl(PyObject *module, PyObject *arg)
|
|
if (PyBytes_AsStringAndSize(bytes, &name, NULL) == -1)
|
|
goto out;
|
|
if ((p = getspnam(name)) == NULL) {
|
|
+// Haiku sets ENOENT if invalid user is specified. Ignore it to make KeyError is set.
|
|
+#ifdef __HAIKU__
|
|
+ if (errno != 0 && errno != ENOENT)
|
|
+#else
|
|
if (errno != 0)
|
|
+#endif
|
|
PyErr_SetFromErrno(PyExc_OSError);
|
|
else
|
|
PyErr_SetString(PyExc_KeyError, "getspnam(): name not found");
|
|
diff --git a/configure.ac b/configure.ac
|
|
index ac3be38..d8ce1f1 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -1159,6 +1159,16 @@ if test $enable_shared = "yes"; then
|
|
PY3LIBRARY=libpython3.so
|
|
fi
|
|
;;
|
|
+ Haiku*)
|
|
+ LDLIBRARY='libpython$(LDVERSION).so'
|
|
+ BLDLIBRARY='-L. -lpython$(LDVERSION)'
|
|
+ RUNSHARED=LIBRARY_PATH=`pwd`${LIBRARY_PATH:+:${LIBRARY_PATH}}
|
|
+ INSTSONAME="$LDLIBRARY".$SOVERSION
|
|
+ if test "$with_pydebug" != yes
|
|
+ then
|
|
+ PY3LIBRARY=libpython3.so
|
|
+ fi
|
|
+ ;;
|
|
hp*|HP*)
|
|
case `uname -m` in
|
|
ia64)
|
|
@@ -1234,6 +1244,7 @@ AC_PROG_MKDIR_P
|
|
AC_SUBST(LN)
|
|
if test -z "$LN" ; then
|
|
case $ac_sys_system in
|
|
+ Haiku*) LN="ln -s";;
|
|
CYGWIN*) LN="ln -s";;
|
|
*) LN=ln;;
|
|
esac
|
|
@@ -2712,7 +2723,7 @@ then
|
|
BLDSHARED="$LDSHARED"
|
|
fi
|
|
;;
|
|
- Linux*|GNU*|QNX*|VxWorks*)
|
|
+ Linux*|GNU*|QNX*|VxWorks*|Haiku*)
|
|
LDSHARED='$(CC) -shared'
|
|
LDCXXSHARED='$(CXX) -shared';;
|
|
FreeBSD*)
|
|
@@ -2779,7 +2790,7 @@ then
|
|
else CCSHARED="+z";
|
|
fi;;
|
|
Linux-android*) ;;
|
|
- Linux*|GNU*) CCSHARED="-fPIC";;
|
|
+ Linux*|GNU*|Haiku*) CCSHARED="-fPIC";;
|
|
FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
|
|
OpenUNIX*|UnixWare*)
|
|
if test "$GCC" = "yes"
|
|
@@ -2807,7 +2818,7 @@ then
|
|
LINKFORSHARED="-Wl,-E -Wl,+s";;
|
|
# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
|
|
Linux-android*) LINKFORSHARED="-pie -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/*)
|
|
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
|
|
@@ -3079,6 +3090,12 @@ AC_SUBST(TZPATH)
|
|
AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
|
|
AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
|
|
|
|
+# Haiku's sockets are stashed in libnetwork.
|
|
+case "$ac_sys_system" in
|
|
+ Haiku*)
|
|
+ AC_CHECK_LIB(network, socket, [LIBS="-lnetwork $LIBS"], [], $LIBS);;
|
|
+esac
|
|
+
|
|
AC_MSG_CHECKING(for --with-libs)
|
|
AC_ARG_WITH(libs,
|
|
AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs (default is no)]),
|
|
@@ -4472,6 +4489,7 @@ AC_CHECK_FUNC(__fpu_control,
|
|
AC_SUBST(LIBM)
|
|
case $ac_sys_system in
|
|
Darwin) ;;
|
|
+Haiku) ;;
|
|
*) LIBM=-lm
|
|
esac
|
|
AC_MSG_CHECKING(for --with-libm=STRING)
|
|
diff --git a/setup.py b/setup.py
|
|
index a39610a..82b06a1 100644
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -86,6 +86,7 @@ CYGWIN = (HOST_PLATFORM == 'cygwin')
|
|
MACOS = (HOST_PLATFORM == 'darwin')
|
|
AIX = (HOST_PLATFORM.startswith('aix'))
|
|
VXWORKS = ('vxworks' in HOST_PLATFORM)
|
|
+HAIKU = (HOST_PLATFORM == 'haiku1')
|
|
CC = os.environ.get("CC")
|
|
if not CC:
|
|
CC = sysconfig.get_config_var("CC")
|
|
@@ -869,6 +870,18 @@ class PyBuildExt(build_ext):
|
|
with open(config_h) as file:
|
|
self.config_h_vars = sysconfig.parse_config_h(file)
|
|
|
|
+ # Haiku-specific library locations
|
|
+ if HAIKU:
|
|
+ self.inc_dirs += ['/boot/develop/headers/posix']
|
|
+ # Are we on x86 32 bits?:
|
|
+ import platform
|
|
+ if platform.machine() == 'BePC':
|
|
+ self.inc_dirs += ['/boot/system/develop/headers/x86']
|
|
+ self.lib_dirs += ['/boot/system/develop/lib/x86']
|
|
+ else:
|
|
+ self.inc_dirs += ['/boot/system/develop/headers']
|
|
+ self.lib_dirs += ['/boot/system/develop/lib']
|
|
+
|
|
# OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
|
|
if HOST_PLATFORM in ['osf1', 'unixware7', 'openunix8']:
|
|
self.lib_dirs += ['/usr/ccs/lib']
|
|
@@ -915,14 +928,14 @@ class PyBuildExt(build_ext):
|
|
extra_compile_args=['-DPy_BUILD_CORE_MODULE'],
|
|
extra_objects=[shared_math],
|
|
depends=['_math.h', shared_math],
|
|
- libraries=['m']))
|
|
+ libraries=[]))
|
|
|
|
# complex math library functions
|
|
self.add(Extension('cmath', ['cmathmodule.c'],
|
|
extra_compile_args=['-DPy_BUILD_CORE_MODULE'],
|
|
extra_objects=[shared_math],
|
|
depends=['_math.h', shared_math],
|
|
- libraries=['m']))
|
|
+ libraries=[]))
|
|
|
|
# time libraries: librt may be needed for clock_gettime()
|
|
time_libs = []
|
|
@@ -936,7 +949,7 @@ class PyBuildExt(build_ext):
|
|
# libm is needed by delta_new() that uses round() and by accum() that
|
|
# uses modf().
|
|
self.add(Extension('_datetime', ['_datetimemodule.c'],
|
|
- libraries=['m'],
|
|
+ libraries=[],
|
|
extra_compile_args=['-DPy_BUILD_CORE_MODULE']))
|
|
# zoneinfo module
|
|
self.add(Extension('_zoneinfo', ['_zoneinfo.c'],
|
|
@@ -1029,7 +1042,7 @@ class PyBuildExt(build_ext):
|
|
#
|
|
# audioop needs libm for floor() in multiple functions.
|
|
self.add(Extension('audioop', ['audioop.c'],
|
|
- libraries=['m']))
|
|
+ libraries=[]))
|
|
|
|
# CSV files
|
|
self.add(Extension('_csv', ['_csv.c']))
|
|
@@ -2272,7 +2285,7 @@ class PyBuildExt(build_ext):
|
|
# function my_sqrt() needs libm for sqrt()
|
|
self.add(Extension('_ctypes_test',
|
|
sources=['_ctypes/_ctypes_test.c'],
|
|
- libraries=['m']))
|
|
+ libraries=[]))
|
|
|
|
ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
|
|
ffi_lib = None
|
|
@@ -2337,7 +2350,7 @@ class PyBuildExt(build_ext):
|
|
'Modules',
|
|
'_decimal',
|
|
'libmpdec'))]
|
|
- libraries = ['m']
|
|
+ libraries = []
|
|
sources = [
|
|
'_decimal/_decimal.c',
|
|
'_decimal/libmpdec/basearith.c',
|
|
@@ -2594,7 +2607,7 @@ class PyBuildExt(build_ext):
|
|
))
|
|
|
|
def detect_nis(self):
|
|
- if MS_WINDOWS or CYGWIN or HOST_PLATFORM == 'qnx6':
|
|
+ if MS_WINDOWS or CYGWIN or HOST_PLATFORM == 'qnx6' or HAIKU:
|
|
self.missing.append('nis')
|
|
return
|
|
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From 2cb60bb4e78604789e8d9c2ef2a25d4ccb380610 Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Sun, 16 Apr 2017 10:05:42 +0200
|
|
Subject: fix for negative errnos
|
|
|
|
|
|
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
|
|
index f1e3d64..255b76a 100644
|
|
--- a/Lib/subprocess.py
|
|
+++ b/Lib/subprocess.py
|
|
@@ -1851,6 +1851,8 @@ class Popen:
|
|
SubprocessError)
|
|
if issubclass(child_exception_type, OSError) and hex_errno:
|
|
errno_num = int(hex_errno, 16)
|
|
+ if sys.platform.startswith('haiku'):
|
|
+ errno_num = -errno_num;
|
|
child_exec_never_called = (err_msg == "noexec")
|
|
if child_exec_never_called:
|
|
err_msg = ""
|
|
diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c
|
|
index b852ad7..60d4a6e 100644
|
|
--- a/Modules/_posixsubprocess.c
|
|
+++ b/Modules/_posixsubprocess.c
|
|
@@ -623,6 +623,10 @@ error:
|
|
char *cur;
|
|
_Py_write_noraise(errpipe_write, "OSError:", 8);
|
|
cur = hex_errno + sizeof(hex_errno);
|
|
+#ifdef __HAIKU__
|
|
+ if (saved_errno < 0)
|
|
+ saved_errno = -saved_errno;
|
|
+#endif
|
|
while (saved_errno != 0 && cur != hex_errno) {
|
|
*--cur = Py_hexdigits[saved_errno % 16];
|
|
saved_errno /= 16;
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From 7bbf8e82cfe9bc304eef77b75dba38783b983d91 Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Sat, 6 Apr 2024 23:49:30 -0300
|
|
Subject: Implement CTypes's find_library for Haiku
|
|
|
|
This combines:
|
|
- the original patch by Philippe Houdoin <philippe.houdoin@gmail.com>
|
|
- A slight variation of Adrien Destugues' fix for x86 32 bits.
|
|
|
|
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
|
|
index 0c2510e..6b88fc8 100644
|
|
--- a/Lib/ctypes/util.py
|
|
+++ b/Lib/ctypes/util.py
|
|
@@ -1,4 +1,5 @@
|
|
import os
|
|
+import platform
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
@@ -265,6 +266,60 @@ elif os.name == "posix":
|
|
def find_library(name, is64 = False):
|
|
return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
|
|
|
|
+ elif sys.platform.startswith("haiku"):
|
|
+
|
|
+ def _num_version(libname):
|
|
+ # "libxyz.so.MAJOR.MINOR" => [ MAJOR, MINOR ]
|
|
+ parts = libname.split('.')
|
|
+ nums = []
|
|
+ try:
|
|
+ while parts:
|
|
+ nums.insert(0, int(parts.pop()))
|
|
+ except ValueError:
|
|
+ pass
|
|
+ return nums or [sys.maxint]
|
|
+
|
|
+ def find_library(name):
|
|
+ if name in ('c', 'm'):
|
|
+ return find_library('root')
|
|
+ for directory in os.environ['LIBRARY_PATH'].split(os.pathsep):
|
|
+ if directory.startswith("%A/"):
|
|
+ directory = directory.replace('%A',
|
|
+ os.path.dirname(os.path.abspath(sys.argv[0] or os.getcwd())))
|
|
+
|
|
+ # Are we on x86 32 bits?:
|
|
+ if platform.machine() == 'BePC':
|
|
+ directory = os.path.join(directory, "x86")
|
|
+
|
|
+ if not os.path.isdir(directory):
|
|
+ continue
|
|
+
|
|
+ # try direct match
|
|
+ fname = os.path.join(directory, name)
|
|
+ if os.path.isfile(fname):
|
|
+ return fname
|
|
+
|
|
+ fname = os.path.join(directory, 'lib%s.so' % name)
|
|
+ if os.path.isfile(fname):
|
|
+ return fname
|
|
+
|
|
+ # no exact matching in this directroy
|
|
+ # collect versioned candidates, if any
|
|
+ candidates = []
|
|
+ pattern = re.compile(r'lib%s\.so\.\S+' % re.escape(name))
|
|
+ for entry in os.listdir(directory):
|
|
+ if not os.path.isfile(os.path.join(directory, entry)):
|
|
+ continue
|
|
+
|
|
+ if re.match(pattern, entry):
|
|
+ candidates.append(os.path.join(directory, entry))
|
|
+
|
|
+ if candidates:
|
|
+ # return latest version found
|
|
+ candidates.sort(key=_num_version)
|
|
+ return candidates[-1]
|
|
+
|
|
+ return None
|
|
else:
|
|
|
|
def _findSoname_ldconfig(name):
|
|
@@ -367,6 +422,12 @@ def test():
|
|
print(f"crypt\t:: {cdll.LoadLibrary(find_library('crypt'))}")
|
|
print(f"crypto\t:: {find_library('crypto')}")
|
|
print(f"crypto\t:: {cdll.LoadLibrary(find_library('crypto'))}")
|
|
+ elif sys.platform.startswith("haiku"):
|
|
+ print(find_library("libbz2.so.1.0"))
|
|
+ print(find_library("tracker"))
|
|
+ print(find_library("media"))
|
|
+ print(cdll.LoadLibrary(find_library("tracker")))
|
|
+ print(cdll.LoadLibrary("libmedia.so"))
|
|
else:
|
|
print(cdll.LoadLibrary("libm.so"))
|
|
print(cdll.LoadLibrary("libcrypt.so"))
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From 3a510daafa1ddc38f5d5f30e5c843e01712ef588 Mon Sep 17 00:00:00 2001
|
|
From: Philipp Wolfer <phil@parolu.io>
|
|
Date: Mon, 23 Sep 2019 09:14:58 +0200
|
|
Subject: webbrowser: Support for default browsers on Haiku
|
|
|
|
|
|
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
|
|
index ec3cece..6a29d2a 100755
|
|
--- a/Lib/webbrowser.py
|
|
+++ b/Lib/webbrowser.py
|
|
@@ -547,6 +547,11 @@ def register_standard_browsers():
|
|
"netscape", "opera", iexplore):
|
|
if shutil.which(browser):
|
|
register(browser, None, BackgroundBrowser(browser))
|
|
+ elif sys.platform[:5] == "haiku":
|
|
+ # First try to use the default configured browser
|
|
+ register("haiku-default", None, GenericBrowser("open"))
|
|
+ # Fall back to WebPositive as the standard browser of Haiku
|
|
+ register("webpositive", None, BackgroundBrowser("WebPositive"))
|
|
else:
|
|
# Prefer X browsers if present
|
|
if os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"):
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From b5394bc38179d91bd6aa0f3bd097bef4d247125c Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Fri, 4 Oct 2019 22:02:35 +0200
|
|
Subject: since 3.8, don't reinit locks on fork.
|
|
|
|
|
|
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
|
|
index d1d4333..bfe60ca 100644
|
|
--- a/Lib/logging/__init__.py
|
|
+++ b/Lib/logging/__init__.py
|
|
@@ -235,7 +235,7 @@ def _releaseLock():
|
|
|
|
# Prevent a held logging lock from blocking a child from logging.
|
|
|
|
-if not hasattr(os, 'register_at_fork'): # Windows and friends.
|
|
+if sys.platform.startswith('haiku') or not hasattr(os, 'register_at_fork'): # Windows and friends.
|
|
def _register_at_fork_reinit_lock(instance):
|
|
pass # no-op when os.register_at_fork does not exist.
|
|
else:
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From ba9e8569858a36f424f7cec947710ffdc3c21923 Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Fri, 15 May 2020 15:20:57 +0200
|
|
Subject: handle errors returned by internal_connect()
|
|
|
|
upstream bug #40628 by Ryan C. Gordon
|
|
|
|
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
|
|
index a4c555c..abdaea7 100644
|
|
--- a/Modules/socketmodule.c
|
|
+++ b/Modules/socketmodule.c
|
|
@@ -3291,7 +3291,7 @@ sock_connect(PySocketSockObject *s, PyObject *addro)
|
|
}
|
|
|
|
res = internal_connect(s, SAS2SA(&addrbuf), addrlen, 1);
|
|
- if (res < 0)
|
|
+ if (res == -1)
|
|
return NULL;
|
|
|
|
Py_RETURN_NONE;
|
|
@@ -3322,7 +3322,7 @@ sock_connect_ex(PySocketSockObject *s, PyObject *addro)
|
|
}
|
|
|
|
res = internal_connect(s, SAS2SA(&addrbuf), addrlen, 0);
|
|
- if (res < 0)
|
|
+ if (res == -1)
|
|
return NULL;
|
|
|
|
return PyLong_FromLong((long) res);
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From 42663421f2b362f6686bc28cf5500e9bf69109a9 Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Mon, 19 Oct 2020 18:03:09 +0200
|
|
Subject: ttyname_r can use MAXPATHLEN
|
|
|
|
|
|
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
|
|
index c0421a9..ace1449 100644
|
|
--- a/Modules/posixmodule.c
|
|
+++ b/Modules/posixmodule.c
|
|
@@ -3079,11 +3079,14 @@ static PyObject *
|
|
os_ttyname_impl(PyObject *module, int fd)
|
|
/*[clinic end generated code: output=c424d2e9d1cd636a input=9ff5a58b08115c55]*/
|
|
{
|
|
-
|
|
+#ifndef __HAIKU__
|
|
long size = sysconf(_SC_TTY_NAME_MAX);
|
|
if (size == -1) {
|
|
return posix_error();
|
|
}
|
|
+#else
|
|
+ long size = MAXPATHLEN;
|
|
+#endif
|
|
char *buffer = (char *)PyMem_RawMalloc(size);
|
|
if (buffer == NULL) {
|
|
return PyErr_NoMemory();
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From e479304cd4cd001cd56d3cac41b25cfb7ce948a0 Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Thu, 25 Jul 2024 17:27:04 -0300
|
|
Subject: Miscellaneous "Lib/test/" fixes for Haiku.
|
|
|
|
This combines test_fileio.py changes from the "initial Haiku patch", plus...
|
|
|
|
"Lib/test: require the "largefile" usage flag for I/O heavy tests.":
|
|
|
|
The same was done for Windows and MacOSX already.
|
|
|
|
This avoids needing several GBs of storage to run the tests
|
|
(unless they "largefile" resource usage flag is enabled).
|
|
|
|
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
|
|
index 4269b0e..314aa75 100644
|
|
--- a/Lib/test/test_fileio.py
|
|
+++ b/Lib/test/test_fileio.py
|
|
@@ -386,6 +386,7 @@ class OtherFileTests:
|
|
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', 'aix')):
|
|
# Somehow /dev/tty appears seekable on some BSDs
|
|
self.assertEqual(f.seekable(), False)
|
|
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
|
|
index 8dae85a..b391a29 100644
|
|
--- a/Lib/test/test_io.py
|
|
+++ b/Lib/test/test_io.py
|
|
@@ -601,7 +601,7 @@ class IOTest(unittest.TestCase):
|
|
# On Windows and Mac OSX this test consumes large resources; It takes
|
|
# a long time to build the >2 GiB file and takes >2 GiB of disk space
|
|
# therefore the resource must be enabled to run this test.
|
|
- if sys.platform[:3] == 'win' or sys.platform == 'darwin':
|
|
+ if sys.platform[:3] == 'win' or sys.platform == 'darwin' or sys.platform == 'haiku1':
|
|
support.requires(
|
|
'largefile',
|
|
'test requires %s bytes and a long time to run' % self.LARGE)
|
|
diff --git a/Lib/test/test_largefile.py b/Lib/test/test_largefile.py
|
|
index 8f6bec1..dcd9678 100644
|
|
--- a/Lib/test/test_largefile.py
|
|
+++ b/Lib/test/test_largefile.py
|
|
@@ -251,7 +251,7 @@ def setUpModule():
|
|
# takes a long time to build the >2 GiB file and takes >2 GiB of disk
|
|
# space therefore the resource must be enabled to run this test.
|
|
# If not, nothing after this line stanza will be executed.
|
|
- if sys.platform[:3] == 'win' or sys.platform == 'darwin':
|
|
+ if sys.platform[:3] == 'win' or sys.platform == 'darwin' or sys.platform == 'haiku1':
|
|
requires('largefile',
|
|
'test requires %s bytes and a long time to run' % str(size))
|
|
else:
|
|
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
|
|
index 307e2b9..afc1772 100644
|
|
--- a/Lib/test/test_mmap.py
|
|
+++ b/Lib/test/test_mmap.py
|
|
@@ -811,7 +811,7 @@ class LargeMmapTests(unittest.TestCase):
|
|
unlink(TESTFN)
|
|
|
|
def _make_test_file(self, num_zeroes, tail):
|
|
- if sys.platform[:3] == 'win' or sys.platform == 'darwin':
|
|
+ if sys.platform[:3] == 'win' or sys.platform == 'darwin' or sys.platform == 'haiku1':
|
|
requires('largefile',
|
|
'test requires %s bytes and a long time to run' % str(0x180000000))
|
|
f = open(TESTFN, 'w+b')
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From fcd2f73417ba32bbfd7501282d5388777cc5e359 Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Thu, 25 Jul 2024 17:27:17 -0300
|
|
Subject: _getuserbase(), getsitepackages(), and INSTALL_SCHEMES for Haiku
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
This combines (at least parts of) previous "commits" on older ".patchset"s:
|
|
|
|
* Initial Haiku patch.
|
|
* default schemes for Haiku
|
|
|
|
from Jérôme Duval
|
|
|
|
* syncronize both _getuserbase() copies on site.py and sysconfig.py.
|
|
* Add missing 'platinclude' to sysconfig's _INSTALL_SCHEMES.
|
|
* Adjust test_sysconfig.test_get_scheme_names for Haiku.
|
|
|
|
by me, plus:
|
|
|
|
new changes to allow Python to find modules installed via 'pkgman -H'.
|
|
|
|
The idea was to have all _getuserbase()/INSTALL_SCHEMES related changes in "one place".
|
|
|
|
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
|
|
index 01d5331..b109392 100644
|
|
--- a/Lib/distutils/command/install.py
|
|
+++ b/Lib/distutils/command/install.py
|
|
@@ -33,13 +33,15 @@ SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')
|
|
# alter locations for packages installations in a single place.
|
|
# Note that this module is deprecated (PEP 632); all consumers
|
|
# of this information should switch to using sysconfig directly.
|
|
-INSTALL_SCHEMES = {"unix_prefix": {}, "unix_home": {}, "nt": {}}
|
|
+INSTALL_SCHEMES = {"unix_prefix": {}, "unix_home": {}, "nt": {},
|
|
+ "haiku": {}, "haiku_vendor": {}, "haiku_home": {}}
|
|
|
|
# Copy from sysconfig._INSTALL_SCHEMES
|
|
for key in SCHEME_KEYS:
|
|
for distutils_scheme_name, sys_scheme_name in (
|
|
("unix_prefix", "posix_prefix"), ("unix_home", "posix_home"),
|
|
- ("nt", "nt")):
|
|
+ ("nt", "nt"), ("haiku", "haiku"), ("haiku_vendor", "haiku_vendor"),
|
|
+ ("haiku_home", "haiku_home")):
|
|
sys_key = key
|
|
sys_scheme = sysconfig._INSTALL_SCHEMES[sys_scheme_name]
|
|
if key == "headers" and key not in sys_scheme:
|
|
@@ -86,6 +88,13 @@ if HAS_USER_SITE:
|
|
'data' : '$userbase',
|
|
}
|
|
|
|
+ INSTALL_SCHEMES['haiku_user'] = {
|
|
+ 'purelib': '$usersite',
|
|
+ 'platlib': '$usersite',
|
|
+ 'headers': '$userbase/develop/headers/python$py_version_short/$dist_name',
|
|
+ 'scripts': '$userbase/bin',
|
|
+ 'data' : '$userbase',
|
|
+ }
|
|
|
|
class install(Command):
|
|
|
|
@@ -431,10 +440,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:
|
|
@@ -450,7 +465,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")
|
|
|
|
def finalize_other(self):
|
|
"""Finalizes options for non-posix platforms"""
|
|
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
|
|
index 3414a76..9115cdc 100644
|
|
--- a/Lib/distutils/sysconfig.py
|
|
+++ b/Lib/distutils/sysconfig.py
|
|
@@ -292,7 +292,8 @@ def get_python_inc(plat_specific=0, prefix=None):
|
|
incdir = os.path.join(get_config_var('srcdir'), 'Include')
|
|
return os.path.normpath(incdir)
|
|
python_dir = 'python' + get_python_version() + build_flags
|
|
- return os.path.join(prefix, "include", python_dir)
|
|
+ inc_dir = "include" if sys.platform != "haiku1" else "develop/headers"
|
|
+ return os.path.join(prefix, inc_dir, python_dir)
|
|
elif os.name == "nt":
|
|
if python_build:
|
|
# Include both the include and PC dir to ensure we can find
|
|
@@ -327,19 +328,27 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
|
|
prefix = plat_specific and EXEC_PREFIX or PREFIX
|
|
|
|
if os.name == "posix":
|
|
- if plat_specific or standard_lib:
|
|
- # Platform-specific modules (any module from a non-pure-Python
|
|
- # module distribution) or standard Python library modules.
|
|
- libdir = sys.platlibdir
|
|
+ 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:
|
|
- # Pure Python
|
|
- libdir = "lib"
|
|
- libpython = os.path.join(prefix, libdir,
|
|
- "python" + get_python_version())
|
|
- if standard_lib:
|
|
- return libpython
|
|
- else:
|
|
- return os.path.join(libpython, "site-packages")
|
|
+ if plat_specific or standard_lib:
|
|
+ # Platform-specific modules (any module from a non-pure-Python
|
|
+ # module distribution) or standard Python library modules.
|
|
+ libdir = sys.platlibdir
|
|
+
|
|
+ # Pure Python
|
|
+ libdir = "lib"
|
|
+ libpython = os.path.join(prefix, libdir,
|
|
+ "python" + get_python_version())
|
|
+ if standard_lib:
|
|
+ return libpython
|
|
+ else:
|
|
+ return os.path.join(libpython, "site-packages")
|
|
elif os.name == "nt":
|
|
if standard_lib:
|
|
return os.path.join(prefix, "Lib")
|
|
diff --git a/Lib/site.py b/Lib/site.py
|
|
index 5302037..69d96a3 100644
|
|
--- a/Lib/site.py
|
|
+++ b/Lib/site.py
|
|
@@ -291,6 +291,14 @@ def _getuserbase():
|
|
return joinuser("~", "Library", sys._framework,
|
|
"%d.%d" % sys.version_info[:2])
|
|
|
|
+ if sys.platform.startswith('haiku'):
|
|
+ try:
|
|
+ import subprocess
|
|
+ return subprocess.check_output(
|
|
+ ['finddir', 'B_USER_NONPACKAGED_DIRECTORY']).rstrip().decode('utf-8')
|
|
+ except:
|
|
+ pass
|
|
+
|
|
return joinuser("~", ".local")
|
|
|
|
|
|
@@ -375,7 +383,31 @@ def getsitepackages(prefixes=None):
|
|
if sys.platlibdir != "lib":
|
|
libdirs.append("lib")
|
|
|
|
- if os.sep == '/':
|
|
+ if sys.platform.startswith('haiku'):
|
|
+ # Locations under /system/
|
|
+ sitepackages.append(os.path.join(prefix, "non-packaged", "lib",
|
|
+ "python%d.%d" % sys.version_info[:2],
|
|
+ "site-packages"))
|
|
+ sitepackages.append(os.path.join(prefix, "lib",
|
|
+ "python%d.%d" % sys.version_info[:2],
|
|
+ "vendor-packages"))
|
|
+
|
|
+ # For .hpkg installed under ~/config/ (pkgman install -H)
|
|
+ # ("pip install --user" uses ~/config/non-packaged/, and gets
|
|
+ # handled by the "haiku_user" install scheme.
|
|
+ try:
|
|
+ import subprocess
|
|
+ _home_prefix = subprocess.check_output(
|
|
+ ['finddir', 'B_USER_CONFIG_DIRECTORY']).rstrip().decode('utf-8')
|
|
+ except:
|
|
+ print("'finddir B_USER_CONFIG_DIRECTORY' failed.")
|
|
+ _home_prefix = None
|
|
+
|
|
+ if _home_prefix is not None:
|
|
+ sitepackages.append(os.path.join(_home_prefix, "lib",
|
|
+ "python%d.%d" % sys.version_info[:2],
|
|
+ "vendor-packages"))
|
|
+ elif os.sep == '/':
|
|
for libdir in libdirs:
|
|
path = os.path.join(prefix, libdir,
|
|
"python%d.%d" % sys.version_info[:2],
|
|
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
|
|
index daf9f00..643c8de 100644
|
|
--- a/Lib/sysconfig.py
|
|
+++ b/Lib/sysconfig.py
|
|
@@ -56,6 +56,36 @@ _INSTALL_SCHEMES = {
|
|
'scripts': '{base}/Scripts',
|
|
'data': '{base}',
|
|
},
|
|
+ 'haiku': {
|
|
+ 'stdlib': '{installed_base}/lib/python{py_version_short}',
|
|
+ 'platstdlib': '{platbase}/lib/python{py_version_short}',
|
|
+ 'purelib': '{base}/non-packaged/lib/python{py_version_short}/site-packages',
|
|
+ 'platlib': '{platbase}/non-packaged/lib/python{py_version_short}/site-packages',
|
|
+ 'include': '{installed_base}/non-packaged/develop/headers/python{py_version_short}',
|
|
+ 'platinclude': '{installed_platbase}/develop/headers/python{py_version_short}',
|
|
+ 'scripts': '{base}/non-packaged/bin',
|
|
+ 'data' : '{base}/non-packaged',
|
|
+ },
|
|
+ 'haiku_vendor': {
|
|
+ 'stdlib': '{installed_base}/lib/python{py_version_short}',
|
|
+ 'platstdlib': '{platbase}/lib/python{py_version_short}',
|
|
+ 'purelib': '{base}/lib/python{py_version_short}/vendor-packages',
|
|
+ 'platlib': '{platbase}/lib/python{py_version_short}/vendor-packages',
|
|
+ 'include': '{installed_base}/develop/headers/python{py_version_short}',
|
|
+ 'platinclude': '{installed_platbase}/develop/headers/python{py_version_short}',
|
|
+ 'scripts': '{base}/bin',
|
|
+ 'data' : '{base}',
|
|
+ },
|
|
+ 'haiku_home': {
|
|
+ 'stdlib': '{installed_base}/lib/python{py_version_short}',
|
|
+ 'platstdlib': '{base}/lib/python{py_version_short}',
|
|
+ 'purelib': '{base}/lib/python{py_version_short}',
|
|
+ 'platlib': '{base}/lib/python{py_version_short}',
|
|
+ 'include': '{installed_base}/develop/headers/python{py_version_short}',
|
|
+ 'platinclude': '{installed_base}/develop/headers/python{py_version_short}',
|
|
+ 'scripts': '{base}/bin',
|
|
+ 'data': '{base}',
|
|
+ },
|
|
}
|
|
|
|
|
|
@@ -81,6 +111,14 @@ def _getuserbase():
|
|
return joinuser("~", "Library", sys._framework,
|
|
f"{sys.version_info[0]}.{sys.version_info[1]}")
|
|
|
|
+ if sys.platform.startswith('haiku'):
|
|
+ try:
|
|
+ import subprocess
|
|
+ return subprocess.check_output(
|
|
+ ['finddir', 'B_USER_NONPACKAGED_DIRECTORY']).rstrip().decode('utf-8')
|
|
+ except:
|
|
+ pass
|
|
+
|
|
return joinuser("~", ".local")
|
|
|
|
_HAS_USER_BASE = (_getuserbase() is not None)
|
|
@@ -106,6 +144,15 @@ if _HAS_USER_BASE:
|
|
'scripts': '{userbase}/bin',
|
|
'data': '{userbase}',
|
|
},
|
|
+ 'haiku_user': {
|
|
+ 'stdlib': '{userbase}/lib/python{py_version_short}',
|
|
+ 'platstdlib': '{userbase}/lib/python{py_version_short}',
|
|
+ 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
|
|
+ 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
|
|
+ 'include': '{userbase}/develop/headers/python{py_version_short}',
|
|
+ 'scripts': '{userbase}/bin',
|
|
+ 'data': '{userbase}',
|
|
+ },
|
|
'osx_framework_user': {
|
|
'stdlib': '{userbase}/lib/python',
|
|
'platstdlib': '{userbase}/lib/python',
|
|
@@ -225,6 +272,18 @@ def _expand_vars(scheme, vars):
|
|
|
|
|
|
def _get_preferred_schemes():
|
|
+ if sys.platform.startswith('haiku'):
|
|
+ if os.environ.get('HAIKU_USE_VENDOR_DIRECTORIES') == '1':
|
|
+ return {
|
|
+ 'prefix': 'haiku_vendor',
|
|
+ 'home': 'haiku_home',
|
|
+ 'user': 'haiku_user',
|
|
+ }
|
|
+ return {
|
|
+ 'prefix': 'haiku',
|
|
+ 'home': 'haiku_home',
|
|
+ 'user': 'haiku_user',
|
|
+ }
|
|
if os.name == 'nt':
|
|
return {
|
|
'prefix': 'nt',
|
|
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
|
|
index 5ee9839..35727c6 100644
|
|
--- a/Lib/test/test_sysconfig.py
|
|
+++ b/Lib/test/test_sysconfig.py
|
|
@@ -263,9 +263,9 @@ class TestSysConfig(unittest.TestCase):
|
|
self.assertTrue(os.path.isfile(config_h), config_h)
|
|
|
|
def test_get_scheme_names(self):
|
|
- wanted = ['nt', 'posix_home', 'posix_prefix']
|
|
+ wanted = ['nt', 'posix_home', 'posix_prefix', 'haiku', 'haiku_vendor', 'haiku_home']
|
|
if HAS_USER_BASE:
|
|
- wanted.extend(['nt_user', 'osx_framework_user', 'posix_user'])
|
|
+ wanted.extend(['nt_user', 'osx_framework_user', 'posix_user', 'haiku_user'])
|
|
self.assertEqual(get_scheme_names(), tuple(sorted(wanted)))
|
|
|
|
@skip_unless_symlink
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From dfbe655d848e18c253f60841daffa79639f7dcbf Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Thu, 25 Jul 2024 17:27:28 -0300
|
|
Subject: Fix location of REPL's history file.
|
|
|
|
Originally from "initial Haiku patch" by Jerome Duval.
|
|
|
|
diff --git a/Lib/site.py b/Lib/site.py
|
|
index 69d96a3..16c4ae7 100644
|
|
--- a/Lib/site.py
|
|
+++ b/Lib/site.py
|
|
@@ -513,8 +513,16 @@ def enablerlcompleter():
|
|
# each interpreter exit when readline was already configured
|
|
# through a PYTHONSTARTUP hook, see:
|
|
# http://bugs.python.org/issue5845#msg198636
|
|
- history = os.path.join(os.path.expanduser('~'),
|
|
- '.python_history')
|
|
+ import subprocess
|
|
+ try:
|
|
+ history = os.path.join(subprocess.check_output(
|
|
+ ['finddir', 'B_USER_VAR_DIRECTORY']).rstrip().decode('utf-8'),
|
|
+ 'python', 'history')
|
|
+ if not os.path.exists(os.path.dirname(history)):
|
|
+ os.makedirs(os.path.dirname(history))
|
|
+ except subprocess.CalledProcessError:
|
|
+ history = os.path.join(os.path.expanduser('~'),
|
|
+ '.python_history')
|
|
try:
|
|
readline.read_history_file(history)
|
|
except OSError:
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From e961a56eda711a52b8bf817fed8dbf4bca6be076 Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Sat, 27 Jan 2024 08:14:52 -0300
|
|
Subject: Apply gh-109191 from Python upstream.
|
|
|
|
Fixes build with newer versions of libedit.
|
|
|
|
Only needed for our 3.10, as it is already fixed upstream for 3.11+.
|
|
|
|
diff --git a/Modules/readline.c b/Modules/readline.c
|
|
index 1d50672..236b11c 100644
|
|
--- a/Modules/readline.c
|
|
+++ b/Modules/readline.c
|
|
@@ -438,7 +438,7 @@ readline_set_completion_display_matches_hook_impl(PyObject *module,
|
|
default completion display. */
|
|
rl_completion_display_matches_hook =
|
|
readlinestate_global->completion_display_matches_hook ?
|
|
-#if defined(_RL_FUNCTION_TYPEDEF)
|
|
+#if defined(HAVE_RL_COMPDISP_FUNC_T)
|
|
(rl_compdisp_func_t *)on_completion_display_matches_hook : 0;
|
|
#else
|
|
(VFunction *)on_completion_display_matches_hook : 0;
|
|
diff --git a/configure b/configure
|
|
index 4b71c4e..d5c0e1c 100755
|
|
--- a/configure
|
|
+++ b/configure
|
|
@@ -16158,6 +16158,23 @@ if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
|
|
|
|
$as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h
|
|
|
|
+fi
|
|
+
|
|
+
|
|
+ # in readline as well as newer editline (April 2023)
|
|
+ ac_fn_c_check_type "$LINENO" "rl_compdisp_func_t" "ac_cv_type_rl_compdisp_func_t" "
|
|
+#include <stdio.h> /* Must be first for Gnu Readline */
|
|
+#ifdef WITH_EDITLINE
|
|
+# include <editline/readline.h>
|
|
+#else
|
|
+# include <readline/readline.h>
|
|
+#endif
|
|
+
|
|
+"
|
|
+if test "x$ac_cv_type_rl_compdisp_func_t" = xyes; then :
|
|
+
|
|
+$as_echo "#define HAVE_RL_COMPDISP_FUNC_T 1" >>confdefs.h
|
|
+
|
|
fi
|
|
|
|
fi
|
|
diff --git a/configure.ac b/configure.ac
|
|
index d8ce1f1..8ac83da 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -5078,6 +5078,20 @@ if test "$py_cv_lib_readline" = yes; then
|
|
AC_CHECK_LIB($LIBREADLINE, append_history,
|
|
AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1,
|
|
[Define if readline supports append_history]),,$READLINE_LIBS)
|
|
+
|
|
+ # in readline as well as newer editline (April 2023)
|
|
+ AC_CHECK_TYPE([rl_compdisp_func_t],
|
|
+ [AC_DEFINE([HAVE_RL_COMPDISP_FUNC_T], [1],
|
|
+ [Define if readline supports rl_compdisp_func_t])],
|
|
+ [],
|
|
+ [
|
|
+#include <stdio.h> /* Must be first for Gnu Readline */
|
|
+#ifdef WITH_EDITLINE
|
|
+# include <editline/readline.h>
|
|
+#else
|
|
+# include <readline/readline.h>
|
|
+#endif
|
|
+ ])
|
|
fi
|
|
|
|
# End of readline checks: restore LIBS
|
|
diff --git a/pyconfig.h.in b/pyconfig.h.in
|
|
index 57c84e5..6d4f5fc 100644
|
|
--- a/pyconfig.h.in
|
|
+++ b/pyconfig.h.in
|
|
@@ -866,6 +866,9 @@
|
|
/* Define if you can turn off readline's signal handling. */
|
|
#undef HAVE_RL_CATCH_SIGNAL
|
|
|
|
+/* Define if readline supports rl_compdisp_func_t */
|
|
+#undef HAVE_RL_COMPDISP_FUNC_T
|
|
+
|
|
/* Define if you have readline 2.2 */
|
|
#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
|
|
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From 8b3b19076cff3e8020b9fcf4c35a1155f6a214a7 Mon Sep 17 00:00:00 2001
|
|
From: Oscar Lesta <oscar.lesta@gmail.com>
|
|
Date: Sat, 10 Feb 2024 06:01:25 -0300
|
|
Subject: Fix build on nightlies, following the addition of kqueue.
|
|
|
|
Together with the patch for gh-109191, fixes HaikuPorts issue #10001.
|
|
|
|
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
|
|
index 3afcb0e..b7a2681 100644
|
|
--- a/Modules/selectmodule.c
|
|
+++ b/Modules/selectmodule.c
|
|
@@ -2570,13 +2570,20 @@ _select_exec(PyObject *m)
|
|
#ifdef EVFILT_SIGNAL
|
|
PyModule_AddIntConstant(m, "KQ_FILTER_SIGNAL", EVFILT_SIGNAL);
|
|
#endif
|
|
+#ifdef EVFILT_TIMER
|
|
PyModule_AddIntConstant(m, "KQ_FILTER_TIMER", EVFILT_TIMER);
|
|
-
|
|
+#endif
|
|
/* event flags */
|
|
PyModule_AddIntConstant(m, "KQ_EV_ADD", EV_ADD);
|
|
PyModule_AddIntConstant(m, "KQ_EV_DELETE", EV_DELETE);
|
|
+#ifdef EV_ENABLE
|
|
PyModule_AddIntConstant(m, "KQ_EV_ENABLE", EV_ENABLE);
|
|
+#else
|
|
+ PyModule_AddIntConstant(m, "KQ_EV_ENABLE", 0); // "test_kqueue.py" assumes KQ_EV_ENABLE exists
|
|
+#endif
|
|
+#ifdef EV_DISABLE
|
|
PyModule_AddIntConstant(m, "KQ_EV_DISABLE", EV_DISABLE);
|
|
+#endif
|
|
PyModule_AddIntConstant(m, "KQ_EV_ONESHOT", EV_ONESHOT);
|
|
PyModule_AddIntConstant(m, "KQ_EV_CLEAR", EV_CLEAR);
|
|
|
|
@@ -2609,14 +2616,28 @@ _select_exec(PyObject *m)
|
|
/* PROC filter flags */
|
|
#ifdef EVFILT_PROC
|
|
PyModule_AddIntConstant(m, "KQ_NOTE_EXIT", NOTE_EXIT);
|
|
+#ifdef NOTE_FORK
|
|
PyModule_AddIntConstant(m, "KQ_NOTE_FORK", NOTE_FORK);
|
|
+#endif
|
|
+#ifdef NOTE_EXEC
|
|
PyModule_AddIntConstant(m, "KQ_NOTE_EXEC", NOTE_EXEC);
|
|
+#endif
|
|
+#ifdef NOTE_PCTRLMASK
|
|
PyModule_AddIntConstant(m, "KQ_NOTE_PCTRLMASK", NOTE_PCTRLMASK);
|
|
+#endif
|
|
+#ifdef NOTE_PDATAMASK
|
|
PyModule_AddIntConstant(m, "KQ_NOTE_PDATAMASK", NOTE_PDATAMASK);
|
|
+#endif
|
|
|
|
+#ifdef NOTE_TRACK
|
|
PyModule_AddIntConstant(m, "KQ_NOTE_TRACK", NOTE_TRACK);
|
|
+#endif
|
|
+#ifdef NOTE_CHILD
|
|
PyModule_AddIntConstant(m, "KQ_NOTE_CHILD", NOTE_CHILD);
|
|
+#endif
|
|
+#ifdef NOTE_TRACKERR
|
|
PyModule_AddIntConstant(m, "KQ_NOTE_TRACKERR", NOTE_TRACKERR);
|
|
+#endif
|
|
#endif
|
|
|
|
/* NETDEV filter flags */
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From 684c9dd79c07ffc6234fb433e186fbe25115c91f Mon Sep 17 00:00:00 2001
|
|
From: Alexander von Gluck IV <kallisti5@unixzen.com>
|
|
Date: Thu, 14 Mar 2024 12:54:33 -0500
|
|
Subject: config.guess: Update to universal haiku arch guessing
|
|
|
|
* Matches upstream config.guess as of 2022, python just
|
|
ships a really old one
|
|
|
|
diff --git a/config.guess b/config.guess
|
|
index e81d3ae..366429c 100755
|
|
--- a/config.guess
|
|
+++ b/config.guess
|
|
@@ -1364,8 +1364,11 @@ EOF
|
|
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
|
GUESS=i586-pc-haiku
|
|
;;
|
|
- x86_64:Haiku:*:*)
|
|
- GUESS=x86_64-unknown-haiku
|
|
+ ppc:Haiku:*:*)
|
|
+ GUESS=powerpc-apple-haiku
|
|
+ ;;
|
|
+ *:Haiku:*:*)
|
|
+ GUESS=$UNAME_MACHINE-unknown-haiku
|
|
;;
|
|
SX-4:SUPER-UX:*:*)
|
|
GUESS=sx4-nec-superux$UNAME_RELEASE
|
|
--
|
|
2.45.2
|
|
|