python3: bump version for 3.5.

This commit is contained in:
Jerome Duval
2017-02-27 17:42:49 +01:00
parent 9f8afb979b
commit 732b313765
2 changed files with 33 additions and 33 deletions

View File

@@ -0,0 +1,540 @@
From ac95fb3752253b437b5bf7a2ca20e6e2527a73b6 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
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index 67db007..dc1c894 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -43,6 +43,27 @@ INSTALL_SCHEMES = {
'data' : '$base',
},
'nt': WINDOWS_SCHEME,
+ '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',
+ },
}
# user site schemes
@@ -64,6 +85,14 @@ 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',
+ }
+
# The keys to an installation scheme; if any new types of files are to be
# installed, be sure to add an entry to every installation scheme above,
# and to SCHEME_KEYS here.
@@ -406,10 +435,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:
@@ -425,7 +460,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 573724d..10dd008 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -102,7 +102,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":
return os.path.join(prefix, "include")
else:
@@ -132,12 +133,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:
return os.path.join(prefix, "Lib")
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/Lib/site.py b/Lib/site.py
index 3f78ef5..e2616e8 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -302,7 +302,14 @@ def getsitepackages(prefixes=None):
continue
seen.add(prefix)
- if os.sep == '/':
+ if sys.platform.startswith('haiku'):
+ sitepackages.append(os.path.join(prefix, "non-packaged", "lib",
+ "python" + sys.version[:3],
+ "site-packages"))
+ sitepackages.append(os.path.join(prefix, "lib",
+ "python" + sys.version[:3],
+ "vendor-packages"))
+ elif os.sep == '/':
sitepackages.append(os.path.join(prefix, "lib",
"python" + sys.version[:3],
"site-packages"))
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index 12f2f11..097ec1b 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -377,6 +377,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/Makefile.pre.in b/Makefile.pre.in
index a88b7d5..c305955 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -125,7 +125,7 @@ BINDIR= @bindir@
LIBDIR= @libdir@
MANDIR= @mandir@
INCLUDEDIR= @includedir@
-CONFINCLUDEDIR= $(exec_prefix)/include
+CONFINCLUDEDIR= $(INCLUDEDIR)
SCRIPTDIR= $(prefix)/lib
ABIFLAGS= @ABIFLAGS@
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 3e446a5..fd24794 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -12788,7 +12788,7 @@ all_ins(PyObject *m)
if (PyModule_AddIntMacro(m, SCHED_RR)) return -1;
#endif
#ifdef SCHED_SPORADIC
- if (PyModule_AddIntMacro(m, SCHED_SPORADIC) return -1;
+ if (PyModule_AddIntMacro(m, SCHED_SPORADIC)) return -1;
#endif
#ifdef SCHED_BATCH
if (PyModule_AddIntMacro(m, SCHED_BATCH)) return -1;
diff --git a/Modules/resource.c b/Modules/resource.c
index 970ee84..c38c716 100644
--- a/Modules/resource.c
+++ b/Modules/resource.c
@@ -83,6 +83,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, 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));
@@ -97,7 +98,22 @@ resource_getrusage(PyObject *self, PyObject *args)
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;
@@ -332,19 +348,19 @@ PyInit_resource(void)
(PyObject*) &StructRUsageType);
/* insert constants */
-#ifdef RLIMIT_CPU
+#if !defined(__HAIKU__) && defined(RLIMIT_CPU)
PyModule_AddIntMacro(m, RLIMIT_CPU);
#endif
-#ifdef RLIMIT_FSIZE
+#if !defined(__HAIKU__) && defined(RLIMIT_FSIZE)
PyModule_AddIntMacro(m, RLIMIT_FSIZE);
#endif
-#ifdef RLIMIT_DATA
+#if !defined(__HAIKU__) && defined(RLIMIT_DATA)
PyModule_AddIntMacro(m, RLIMIT_DATA);
#endif
-#ifdef RLIMIT_STACK
+#if !defined(__HAIKU__) && defined(RLIMIT_STACK)
PyModule_AddIntMacro(m, RLIMIT_STACK);
#endif
@@ -356,31 +372,31 @@ PyInit_resource(void)
PyModule_AddIntMacro(m, RLIMIT_NOFILE);
#endif
-#ifdef RLIMIT_OFILE
+#if !defined(__HAIKU__) && defined(RLIMIT_OFILE)
PyModule_AddIntMacro(m, RLIMIT_OFILE);
#endif
-#ifdef RLIMIT_VMEM
+#if !defined(__HAIKU__) && defined(RLIMIT_VMEM)
PyModule_AddIntMacro(m, RLIMIT_VMEM);
#endif
-#ifdef RLIMIT_AS
+#if !defined(__HAIKU__) && defined(RLIMIT_AS)
PyModule_AddIntMacro(m, RLIMIT_AS);
#endif
-#ifdef RLIMIT_RSS
+#if !defined(__HAIKU__) && defined(RLIMIT_RSS)
PyModule_AddIntMacro(m, RLIMIT_RSS);
#endif
-#ifdef RLIMIT_NPROC
+#if !defined(__HAIKU__) && defined(RLIMIT_NPROC)
PyModule_AddIntMacro(m, RLIMIT_NPROC);
#endif
-#ifdef RLIMIT_MEMLOCK
+#if !defined(__HAIKU__) && defined(RLIMIT_MEMLOCK)
PyModule_AddIntMacro(m, RLIMIT_MEMLOCK);
#endif
-#ifdef RLIMIT_SBSIZE
+#if !defined(__HAIKU__) && defined(RLIMIT_SBSIZE)
PyModule_AddIntMacro(m, RLIMIT_SBSIZE);
#endif
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index af6cc94..8631fca 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -6443,7 +6443,9 @@ PyInit__socket(void)
PyModule_AddIntMacro(m, SOCK_DGRAM);
/* We have incomplete socket support. */
PyModule_AddIntMacro(m, SOCK_RAW);
+#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 3cce927..6241a7d 100644
--- a/Modules/socketmodule.h
+++ b/Modules/socketmodule.h
@@ -54,6 +54,10 @@ typedef int socklen_t;
# 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 --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c
index 4b9f3cd..76e7d46 100644
--- a/Modules/spwdmodule.c
+++ b/Modules/spwdmodule.c
@@ -87,7 +87,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/Python/bltinmodule.c b/Python/bltinmodule.c
index 9f5db2a..0091e48 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -24,7 +24,7 @@
#ifdef HAVE_MBCS
const char *Py_FileSystemDefaultEncoding = "mbcs";
int Py_HasFileSystemDefaultEncoding = 1;
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__HAIKU__)
const char *Py_FileSystemDefaultEncoding = "utf-8";
int Py_HasFileSystemDefaultEncoding = 1;
#else
diff --git a/Tools/scripts/h2py.py b/Tools/scripts/h2py.py
index 0967fc2..e30a59a 100755
--- a/Tools/scripts/h2py.py
+++ b/Tools/scripts/h2py.py
@@ -49,12 +49,15 @@ except KeyError:
try:
searchdirs=os.environ['INCLUDE'].split(';')
except KeyError:
- searchdirs=['/usr/include']
- try:
- searchdirs.insert(0, os.path.join('/usr/include',
+ if sys.platform.find("beos") == 0 or sys.platform.find("haiku1") == 0:
+ searchdirs=os.environ['BEINCLUDES'].split(';')
+ else:
+ searchdirs=['/usr/include']
+ try:
+ searchdirs.insert(0, os.path.join('/usr/include',
os.environ['MULTIARCH']))
- except KeyError:
- pass
+ except KeyError:
+ pass
def main():
global filedict
diff --git a/configure.ac b/configure.ac
index 49d1a37..34a810e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1129,6 +1129,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)
@@ -1205,6 +1215,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
@@ -2437,7 +2448,7 @@ then
BLDSHARED="$LDSHARED"
fi
;;
- Linux*|GNU*|QNX*)
+ Linux*|GNU*|QNX*|Haiku*)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
BSD/OS*/4*)
@@ -2506,7 +2517,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*)
@@ -2537,7 +2548,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/*)
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
@@ -2719,6 +2730,12 @@ LDFLAGS="-fsanitize=address $LDFLAGS"
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]),
@@ -4066,6 +4083,7 @@ fi],
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 40f8bf2..be498e3 100644
--- a/setup.py
+++ b/setup.py
@@ -480,8 +480,8 @@ class PyBuildExt(build_ext):
os.unlink(tmpfile)
def detect_math_libs(self):
- # Check for MacOS X, which doesn't need libm.a at all
- if host_platform == 'darwin':
+ # Check for MacOS X and Haiku, which doesn't need libm.a at all
+ if host_platform in ['darwin','haiku1']:
return []
else:
return ['m']
@@ -563,6 +563,12 @@ class PyBuildExt(build_ext):
config_h_vars = sysconfig.parse_config_h(file)
srcdir = sysconfig.get_config_var('srcdir')
+
+ # Haiku-specific library locations
+ if host_platform == 'haiku1':
+ inc_dirs += ['/boot/develop/headers/posix',
+ '/boot/system/develop/headers']
+ 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']:
@@ -811,15 +817,22 @@ class PyBuildExt(build_ext):
'/usr/local/ssl/include',
'/usr/contrib/ssl/include/'
]
- ssl_incs = find_file('openssl/ssl.h', inc_dirs,
+ ssl_incs = find_file('openssl/ssl.h', [],
+ inc_dirs + search_for_ssl_incs_in
+ )
+ ssl_incs_to_add = find_file('openssl/ssl.h', inc_dirs,
search_for_ssl_incs_in
)
if ssl_incs is not None:
krb5_h = find_file('krb5.h', inc_dirs,
['/usr/kerberos/include'])
if krb5_h:
- ssl_incs += krb5_h
- ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
+ ssl_incs_to_add += krb5_h
+ ssl_libs = find_library_file(self.compiler, 'ssl', [],
+ lib_dirs + ['/usr/local/ssl/lib',
+ '/usr/contrib/ssl/lib/'
+ ] )
+ ssl_libs_to_add = find_library_file(self.compiler, 'ssl', lib_dirs,
['/usr/local/ssl/lib',
'/usr/contrib/ssl/lib/'
] )
@@ -827,8 +840,8 @@ class PyBuildExt(build_ext):
if (ssl_incs is not None and
ssl_libs is not None):
exts.append( Extension('_ssl', ['_ssl.c'],
- include_dirs = ssl_incs,
- library_dirs = ssl_libs,
+ include_dirs = ssl_incs_to_add,
+ library_dirs = ssl_libs_to_add,
libraries = ['ssl', 'crypto'],
depends = ['socketmodule.h']), )
else:
@@ -868,8 +881,8 @@ class PyBuildExt(build_ext):
# of hash functions from the OpenSSL library.
exts.append( Extension('_hashlib', ['_hashopenssl.c'],
depends = ['hashlib.h'],
- include_dirs = ssl_incs,
- library_dirs = ssl_libs,
+ include_dirs = ssl_incs_to_add,
+ library_dirs = ssl_libs_to_add,
libraries = ['ssl', 'crypto']) )
else:
print("warning: openssl 0x%08x is too old for _hashlib" %
@@ -1303,7 +1316,7 @@ class PyBuildExt(build_ext):
exts.append( Extension('resource', ['resource.c']) )
# Sun yellow pages. Some systems have the functions in libc.
- if (host_platform not in ['cygwin', 'qnx6'] and
+ if (host_platform not in ['cygwin', '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']
--
2.10.2