From 53f4430bf9c9c0acf40a61fb5f6603f48a8d00ca Mon Sep 17 00:00:00 2001 From: Mehdi Chinoune Date: Fri, 9 Dec 2022 19:55:30 +0000 Subject: [PATCH] python-scikit-learn: update to 1.2.0 --- .../001-mingw-python-openmp-flag.patch | 14 ++++----- .../002-openmp-cleanup-wait.patch | 4 +-- .../003-Fix-optimization-flag.patch | 11 +++++++ mingw-w64-python-scikit-learn/PKGBUILD | 31 +++++++++++-------- 4 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 mingw-w64-python-scikit-learn/003-Fix-optimization-flag.patch diff --git a/mingw-w64-python-scikit-learn/001-mingw-python-openmp-flag.patch b/mingw-w64-python-scikit-learn/001-mingw-python-openmp-flag.patch index 9a40f629b3..34b5f834c1 100644 --- a/mingw-w64-python-scikit-learn/001-mingw-python-openmp-flag.patch +++ b/mingw-w64-python-scikit-learn/001-mingw-python-openmp-flag.patch @@ -1,11 +1,11 @@ --- a/sklearn/_build_utils/openmp_helpers.py +++ b/sklearn/_build_utils/openmp_helpers.py -@@ -23,7 +23,7 @@ +@@ -18,7 +18,7 @@ + else: + compiler = compiler.__class__.__name__ - if sys.platform == "win32" and ("icc" in compiler or "icl" in compiler): - return ["/Qopenmp"] -- elif sys.platform == "win32": -+ elif sys.platform == "win32" and not 'GCC' in sys.version: +- if sys.platform == "win32": ++ if sys.platform == "win32" and 'MSC' in sys.version: return ["/openmp"] - elif sys.platform in ("darwin", "linux") and "icc" in compiler: - return ["-qopenmp"] + elif sys.platform == "darwin" and "openmp" in os.getenv("CPPFLAGS", ""): + # -fopenmp can't be passed as compile flag when using Apple-clang. diff --git a/mingw-w64-python-scikit-learn/002-openmp-cleanup-wait.patch b/mingw-w64-python-scikit-learn/002-openmp-cleanup-wait.patch index 57f22408fd..5310cfa572 100644 --- a/mingw-w64-python-scikit-learn/002-openmp-cleanup-wait.patch +++ b/mingw-w64-python-scikit-learn/002-openmp-cleanup-wait.patch @@ -7,8 +7,8 @@ +import time import tempfile import textwrap - import setuptools # noqa -@@ -93,6 +93,7 @@ + import subprocess +@@ -61,6 +61,7 @@ raise finally: os.chdir(start_dir) diff --git a/mingw-w64-python-scikit-learn/003-Fix-optimization-flag.patch b/mingw-w64-python-scikit-learn/003-Fix-optimization-flag.patch new file mode 100644 index 0000000000..4dbfe6332e --- /dev/null +++ b/mingw-w64-python-scikit-learn/003-Fix-optimization-flag.patch @@ -0,0 +1,11 @@ +--- a/setup.py ++++ b/setup.py +@@ -499,7 +499,7 @@ + np_include = numpy.get_include() + + optimization_level = "O2" +- if os.name == "posix": ++ if not "MSC" in sys.version: + default_extra_compile_args = [f"-{optimization_level}"] + default_libraries = ["m"] + else: diff --git a/mingw-w64-python-scikit-learn/PKGBUILD b/mingw-w64-python-scikit-learn/PKGBUILD index a77a7203bb..87460c6578 100644 --- a/mingw-w64-python-scikit-learn/PKGBUILD +++ b/mingw-w64-python-scikit-learn/PKGBUILD @@ -6,7 +6,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}") provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}") conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}") replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}") -pkgver=1.1.3 +pkgver=1.2.0 pkgrel=1 pkgdesc="A set of python modules for machine learning and data mining (mingw-w64)" arch=('any') @@ -18,20 +18,26 @@ depends=("${MINGW_PACKAGE_PREFIX}-python" "${MINGW_PACKAGE_PREFIX}-python-scipy" "${MINGW_PACKAGE_PREFIX}-python-joblib" "${MINGW_PACKAGE_PREFIX}-python-threadpoolctl") -makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools" +makedepends=("${MINGW_PACKAGE_PREFIX}-python-build" + "${MINGW_PACKAGE_PREFIX}-python-installer" + "${MINGW_PACKAGE_PREFIX}-python-setuptools" + "${MINGW_PACKAGE_PREFIX}-python-wheel" "${MINGW_PACKAGE_PREFIX}-cython" "${MINGW_PACKAGE_PREFIX}-cc") -source=("${_realname}-${pkgver}.tar.gz::https://github.com/scikit-learn/${_realname}/archive/${pkgver}.tar.gz" +source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz" 001-mingw-python-openmp-flag.patch - 002-openmp-cleanup-wait.patch) -sha256sums=('b7c0a9fb8dfcefcfc7ef8fe02a064d194980251d57efaea972cb76005afb3c63' - '88e693d40aded60033737ca8bbfe7850ab73a3e05941bc25247f3eaa50850dd5' - 'd2479335dff939c03662028145c81556e8d6ceef9bcbfbe688993b62faddb8a1') + 002-openmp-cleanup-wait.patch + 003-Fix-optimization-flag.patch) +sha256sums=('680b65b3caee469541385d2ca5b03ff70408f6c618c583948312f0d2125df680' + '7817f0ac38fd47fb5731abf6ba76f0e8d6534f98e085048d0bc9cb5e402c8d43' + 'b9e8d52dd9f989c8b75c086653690598f28378451fbd7078e8163bff1d76452e' + '28b5bb841050cce6e77e6ce9078097ed39e6ff0e2ff3f20b12368701bf92ff3c') prepare() { cd ${_realname}-${pkgver} patch -p1 -i ${srcdir}/001-mingw-python-openmp-flag.patch patch -p1 -i ${srcdir}/002-openmp-cleanup-wait.patch + patch -p1 -i ${srcdir}/003-Fix-optimization-flag.patch cd ${srcdir} rm -rf python-build-${MSYSTEM} | true @@ -39,18 +45,17 @@ prepare() { } build() { - msg "Python build for ${MSYSTEM}" cd "${srcdir}/python-build-${MSYSTEM}" - ${MINGW_PREFIX}/bin/python setup.py build + ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation } package() { cd "${srcdir}/python-build-${MSYSTEM}" - MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ - ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \ - --root="${pkgdir}" --optimize=1 --skip-build + MSYS2_ARG_CONV_EXCL="--prefix=" \ + ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \ + --destdir="${pkgdir}" dist/*.whl - install -Dm644 COPYING "${pkgdir}"${MINGW_PREFIX}/share/licenses/python-${_realname}/COPYING + install -Dm644 COPYING "${pkgdir}"${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE install -d ${pkgdir}${MINGW_PREFIX}/share/doc/python-${_realname} cp -r doc/tutorial ${pkgdir}${MINGW_PREFIX}/share/doc/python-${_realname}/tutorial