python38: add sysconfig haiku schemes

This commit is contained in:
Jerome Duval
2023-03-07 17:49:21 +01:00
parent 8e654e4867
commit 6a86ae3bdd
2 changed files with 88 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
From 3467984d1c13cc560054e7c70a026a8a9afbadbe Mon Sep 17 00:00:00 2001
From a8d70b56a1ad0e11567806ceac6015a03f8aaf7d Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 10 Apr 2014 16:03:33 +0000
Subject: initial Haiku patch
@@ -419,10 +419,10 @@ index ea37c04..d6dc9e9 100755
def main():
global filedict
diff --git a/configure.ac b/configure.ac
index e02cc2c..b7731f8 100644
index de83332..c128963 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1148,6 +1148,16 @@ if test $enable_shared = "yes"; then
@@ -1150,6 +1150,16 @@ if test $enable_shared = "yes"; then
PY3LIBRARY=libpython3.so
fi
;;
@@ -439,7 +439,7 @@ index e02cc2c..b7731f8 100644
hp*|HP*)
case `uname -m` in
ia64)
@@ -1223,6 +1233,7 @@ AC_PROG_MKDIR_P
@@ -1225,6 +1235,7 @@ AC_PROG_MKDIR_P
AC_SUBST(LN)
if test -z "$LN" ; then
case $ac_sys_system in
@@ -447,7 +447,7 @@ index e02cc2c..b7731f8 100644
CYGWIN*) LN="ln -s";;
*) LN=ln;;
esac
@@ -2627,7 +2638,7 @@ then
@@ -2629,7 +2640,7 @@ then
BLDSHARED="$LDSHARED"
fi
;;
@@ -456,7 +456,7 @@ index e02cc2c..b7731f8 100644
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
FreeBSD*)
@@ -2694,7 +2705,7 @@ then
@@ -2696,7 +2707,7 @@ then
else CCSHARED="+z";
fi;;
Linux-android*) ;;
@@ -465,7 +465,7 @@ index e02cc2c..b7731f8 100644
FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
OpenUNIX*|UnixWare*)
if test "$GCC" = "yes"
@@ -2722,7 +2733,7 @@ then
@@ -2724,7 +2735,7 @@ then
LINKFORSHARED="-Wl,-E -Wl,+s";;
# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";;
@@ -474,7 +474,7 @@ index e02cc2c..b7731f8 100644
# -u libsys_s pulls in all symbols in libsys
Darwin/*)
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
@@ -2971,6 +2982,12 @@ LDFLAGS="-fsanitize=undefined $LDFLAGS"
@@ -2973,6 +2984,12 @@ LDFLAGS="-fsanitize=undefined $LDFLAGS"
AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
@@ -487,7 +487,7 @@ index e02cc2c..b7731f8 100644
AC_MSG_CHECKING(for --with-libs)
AC_ARG_WITH(libs,
AS_HELP_STRING([--with-libs='lib1 ...'], [link against additional libs]),
@@ -4353,6 +4370,7 @@ AC_CHECK_FUNC(__fpu_control,
@@ -4355,6 +4372,7 @@ AC_CHECK_FUNC(__fpu_control,
AC_SUBST(LIBM)
case $ac_sys_system in
Darwin) ;;
@@ -496,7 +496,7 @@ index e02cc2c..b7731f8 100644
esac
AC_MSG_CHECKING(for --with-libm=STRING)
diff --git a/setup.py b/setup.py
index 2d6b056..3da2ac8 100644
index 57be07a..7efc014 100644
--- a/setup.py
+++ b/setup.py
@@ -46,6 +46,7 @@ CYGWIN = (HOST_PLATFORM == 'cygwin')
@@ -553,7 +553,7 @@ index 2d6b056..3da2ac8 100644
# CSV files
self.add(Extension('_csv', ['_csv.c']))
@@ -1996,7 +2002,7 @@ class PyBuildExt(build_ext):
@@ -1998,7 +2004,7 @@ class PyBuildExt(build_ext):
# function my_sqrt() needs libm for sqrt()
self.add(Extension('_ctypes_test',
sources=['_ctypes/_ctypes_test.c'],
@@ -562,7 +562,7 @@ index 2d6b056..3da2ac8 100644
ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
ffi_lib = None
@@ -2061,7 +2067,7 @@ class PyBuildExt(build_ext):
@@ -2063,7 +2069,7 @@ class PyBuildExt(build_ext):
'Modules',
'_decimal',
'libmpdec'))]
@@ -571,7 +571,7 @@ index 2d6b056..3da2ac8 100644
sources = [
'_decimal/_decimal.c',
'_decimal/libmpdec/basearith.c',
@@ -2255,7 +2261,7 @@ class PyBuildExt(build_ext):
@@ -2257,7 +2263,7 @@ class PyBuildExt(build_ext):
depends=sha3_deps))
def detect_nis(self):
@@ -581,10 +581,10 @@ index 2d6b056..3da2ac8 100644
return
--
2.30.2
2.37.3
From 0a68291ae34410b332c7affde2a3dae6ac74465e Mon Sep 17 00:00:00 2001
From ed06d3879a06d1f7e29eeb3cca73b063c7496488 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
@@ -619,10 +619,10 @@ index 05c051c..c7ea3ef 100644
*--cur = Py_hexdigits[saved_errno % 16];
saved_errno /= 16;
--
2.30.2
2.37.3
From 6b07a04e9cec2dc184208e80562e720c11a4a25e Mon Sep 17 00:00:00 2001
From 7c9d6da0ef616d12ed9dab1dcc9275cbe7975815 Mon Sep 17 00:00:00 2001
From: Philippe Houdoin <philippe.houdoin@gmail.com>
Date: Wed, 24 May 2017 11:09:43 +0000
Subject: Implement CTypes's find_library for Haiku
@@ -703,10 +703,10 @@ index 0c2510e..2b4f04c 100644
print(cdll.LoadLibrary("libm.so"))
print(cdll.LoadLibrary("libcrypt.so"))
--
2.30.2
2.37.3
From 70ee258dec05734deeeed7a8ea4d369a2cf065e3 Mon Sep 17 00:00:00 2001
From 108a6983cdd7d0768fbe6f02552c20698ebd4b93 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
@@ -729,10 +729,10 @@ index 6023c1e..8359531 100755
# Prefer X browsers if present
if os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"):
--
2.30.2
2.37.3
From db68381973fce91025f97cd8ed6ec5ce944a6e88 Mon Sep 17 00:00:00 2001
From 15898feb95061bdabb754fd8d94e8a30b68dff2c 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.
@@ -752,10 +752,10 @@ index b393ddd..9f6362f 100644
pass # no-op when os.register_at_fork does not exist.
else:
--
2.30.2
2.37.3
From be76f6e3e50fa4da2da30c9fcc2b1960d8d5dacb Mon Sep 17 00:00:00 2001
From 1a524f5b18450e5af52fb90220d19fb7771daeb1 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()
@@ -785,20 +785,20 @@ index 062ca45..ac29f71 100644
return PyLong_FromLong((long) res);
--
2.30.2
2.37.3
From a65ae93e0be3e998c5e47210107ea2bcbe985c4f Mon Sep 17 00:00:00 2001
From 3cfab461717e4de619d0358ed40a14fb1e7f8880 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Mon, 23 May 2022 12:41:29 +0200
Subject: Fix search paths for tcl/tk
diff --git a/configure.ac b/configure.ac
index b7731f8..d8806df 100644
index c128963..8b4c4fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3096,8 +3096,13 @@ then
@@ -3098,8 +3098,13 @@ then
then
AC_MSG_ERROR([use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither])
fi
@@ -815,5 +815,64 @@ index b7731f8..d8806df 100644
TCLTK_INCLUDES="$with_tcltk_includes"
TCLTK_LIBS="$with_tcltk_libs"
--
2.36.1
2.37.3
From 77f377467882fc1b3ad33b9769a70f8e4412e704 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 7 Mar 2023 17:09:55 +0100
Subject: sysconfig: add haiku schemes
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index 3f702d7..fb75ecf 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -84,6 +84,33 @@ _INSTALL_SCHEMES = {
'scripts': '{userbase}/bin',
'data': '{userbase}',
},
+ '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': '{base}/non-packaged/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': '{base}/develop/headers/python{py_version_short}',
+ 'scripts': '{base}/bin',
+ 'data' : '{base}',
+ },
+ 'haiku_home': {
+ 'stdlib': '{userbase}/lib/python{py_version_short}',
+ 'platstdlib': '{platbase}/lib/python{py_version_short}',
+ 'purelib': '{userbase}/lib/python',
+ 'platlib': '{userbase}/lib/python',
+ 'include': '{userbase}/develop/headers/python/$dist_name',
+ 'scripts': '{userbase}/bin',
+ 'data' : '{userbase}',
+ },
}
_SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include',
@@ -184,6 +211,10 @@ def _expand_vars(scheme, vars):
def _get_default_scheme():
+ if sys.platform.startswith('haiku'):
+ if os.environ.get('HAIKU_USE_VENDOR_DIRECTORIES') == '1':
+ return 'haiku_vendor'
+ return 'haiku'
if os.name == 'posix':
# the default scheme for posix is posix_prefix
return 'posix_prefix'
--
2.37.3