From 2411c135d90a668c4be5174b71685e312c1350d7 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Sun, 16 Apr 2017 21:33:04 +0200 Subject: [PATCH] python3: handle negative errno on Haiku. also enable _BSD_SOURCE for openpty declaration. --- .../python/patches/python3-3.6.1.patchset | 42 ++++++++++++++++++- dev-lang/python/python3-3.6.1.recipe | 3 +- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/dev-lang/python/patches/python3-3.6.1.patchset b/dev-lang/python/patches/python3-3.6.1.patchset index 965d5e71c..dca1817b2 100644 --- a/dev-lang/python/patches/python3-3.6.1.patchset +++ b/dev-lang/python/patches/python3-3.6.1.patchset @@ -1,4 +1,4 @@ -From 174b88cd6fbb388545efb2e1218d13eb254defa8 Mon Sep 17 00:00:00 2001 +From 4f5d1b027f1e5b1bba2155aec103cec7233f9d7c Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Thu, 10 Apr 2014 16:03:33 +0000 Subject: initial Haiku patch @@ -536,5 +536,43 @@ index f04bf22..718c03a 100644 if (self.compiler.find_library_file(lib_dirs, 'nsl')): libs = ['nsl'] -- -2.10.2 +2.11.0 + + +From 7133afd2665e636cd11daadbaa672f1a45ed031e Mon Sep 17 00:00:00 2001 +From: Jerome Duval +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 822ddb4..5334f2d 100644 +--- a/Lib/subprocess.py ++++ b/Lib/subprocess.py +@@ -1312,6 +1312,8 @@ class Popen(object): + err_msg = err_msg.decode(errors="surrogatepass") + 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 5007a39..625c507 100644 +--- a/Modules/_posixsubprocess.c ++++ b/Modules/_posixsubprocess.c +@@ -521,6 +521,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.11.0 diff --git a/dev-lang/python/python3-3.6.1.recipe b/dev-lang/python/python3-3.6.1.recipe index 3130ac5e1..2f64536af 100644 --- a/dev-lang/python/python3-3.6.1.recipe +++ b/dev-lang/python/python3-3.6.1.recipe @@ -11,7 +11,7 @@ OSI-approved open source license. HOMEPAGE="http://www.python.org" LICENSE="Python" COPYRIGHT="1990-2016, Python Software Foundation" -REVISION="1" +REVISION="2" SOURCE_URI="https://www.python.org/ftp/python/$portVersion/Python-$portVersion.tar.xz" CHECKSUM_SHA256="a01810ddfcec216bcdb357a84bfaafdfaa0ca42bbdaa4cb7ff74f5a9961e4041" SOURCE_DIR="Python-$portVersion" @@ -87,6 +87,7 @@ GLOBAL_WRITABLE_FILES=" BUILD() { + export CFLAGS="-D_BSD_SOURCE" rm -Rf Modules/zlib Modules/expat cd Modules/_ctypes/libffi