From 64e6b104d478abd3ba38cc9c4f8f2f53b56a8823 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Fri, 24 Sep 2021 23:15:42 -0400 Subject: [PATCH] boost: rebuild for Python 3.10 --- common/shlibs | 2 +- srcpkgs/boost/patches/exec_file.patch | 45 +++++++++++++++++++++++++++ srcpkgs/boost/template | 2 +- 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/boost/patches/exec_file.patch diff --git a/common/shlibs b/common/shlibs index 4e7b70f6b1..458f7dfcd1 100644 --- a/common/shlibs +++ b/common/shlibs @@ -644,7 +644,7 @@ libboost_stacktrace_noop.so.1.72.0 libboost_stacktrace_noop1.72-1.72.0_1 libboost_stacktrace_addr2line.so.1.72.0 libboost_stacktrace_addr2line1.72-1.72.0_1 libboost_stacktrace_basic.so.1.72.0 libboost_stacktrace_basic1.72-1.72.0_1 libboost_python27.so.1.72.0 boost-python1.72-1.72.0_1 -libboost_python39.so.1.72.0 boost-python3-1.72-1.72.0_4 +libboost_python310.so.1.72.0 boost-python3-1.72-1.72.0_6 libexempi.so.8 exempi-2.5.0_1 libatasmart.so.4 libatasmart-0.17_1 libsgutils2-1.45.so.2 libsgutils-1.45_1 diff --git a/srcpkgs/boost/patches/exec_file.patch b/srcpkgs/boost/patches/exec_file.patch new file mode 100644 index 0000000000..b1b0ef969c --- /dev/null +++ b/srcpkgs/boost/patches/exec_file.patch @@ -0,0 +1,45 @@ +From d9f06052e28873037db7f98629bce72182a42410 Mon Sep 17 00:00:00 2001 +From: Pat Riehecky +Date: Mon, 29 Jun 2020 10:51:58 -0500 +Subject: [PATCH] Convert Python 3.1+ to use public C API for filenames + + [ + Ed.: Paths were adapted from upstream commit + https://github.com/boostorg/python/commit/d9f06052e28873037db7f98629bce72182a42410 + ] + +--- + src/exec.cpp | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/libs/python/src/exec.cpp b/libs/python/src/exec.cpp +index 171c6f4189..b2eabe59f6 100644 +--- a/libs/python/src/exec.cpp ++++ b/libs/python/src/exec.cpp +@@ -104,14 +104,22 @@ object BOOST_PYTHON_DECL exec_file(char const *filename, object global, object l + if (local.is_none()) local = global; + // should be 'char const *' but older python versions don't use 'const' yet. + char *f = const_cast(filename); +- // Let python open the file to avoid potential binary incompatibilities. +-#if PY_VERSION_HEX >= 0x03040000 +- FILE *fs = _Py_fopen(f, "r"); ++#if PY_VERSION_HEX >= 0x03010000 ++ // Let python manage any UTF bits to avoid potential incompatibilities. ++ PyObject *fo = Py_BuildValue("s", f); ++ PyObject *fb = Py_None; ++ PyUnicode_FSConverter(fo, &fb); ++ f = PyBytes_AsString(fb); ++ FILE *fs = fopen(f, "r"); ++ Py_DECREF(fo); ++ Py_DECREF(fb); + #elif PY_VERSION_HEX >= 0x03000000 ++ // Let python open the file to avoid potential binary incompatibilities. + PyObject *fo = Py_BuildValue("s", f); +- FILE *fs = _Py_fopen(fo, "r"); ++ FILE *fs = _Py_fopen(fo, "r"); // Private CPython API + Py_DECREF(fo); + #else ++ // Let python open the file to avoid potential binary incompatibilities. + PyObject *pyfile = PyFile_FromString(f, const_cast("r")); + if (!pyfile) throw std::invalid_argument(std::string(f) + " : no such file"); + python::handle<> file(pyfile); diff --git a/srcpkgs/boost/template b/srcpkgs/boost/template index 61749aaeba..f5881e536b 100644 --- a/srcpkgs/boost/template +++ b/srcpkgs/boost/template @@ -1,7 +1,7 @@ # Template file for 'boost' pkgname=boost version=1.72.0 -revision=5 +revision=6 wrksrc="${pkgname}_${version//\./_}" hostmakedepends="which bzip2-devel icu-devel python-devel python3-devel" makedepends="zlib-devel bzip2-devel icu-devel python-devel python3-devel"