From e46b70f72346161e311d390e7b1c5b12f577c76a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sun, 13 Nov 2022 00:33:48 -0300 Subject: [PATCH] python3-cvxopt: revbump for SuiteSparse 6.0.1. - use openblas instead of lapack when available. --- srcpkgs/python3-cvxopt/patches/fix-gsl.patch | 11 --- .../python3-cvxopt/patches/test-modules.patch | 76 +++++++++++++++++++ srcpkgs/python3-cvxopt/template | 18 ++++- 3 files changed, 91 insertions(+), 14 deletions(-) delete mode 100644 srcpkgs/python3-cvxopt/patches/fix-gsl.patch create mode 100644 srcpkgs/python3-cvxopt/patches/test-modules.patch diff --git a/srcpkgs/python3-cvxopt/patches/fix-gsl.patch b/srcpkgs/python3-cvxopt/patches/fix-gsl.patch deleted file mode 100644 index e32dc2fbf1e..00000000000 --- a/srcpkgs/python3-cvxopt/patches/fix-gsl.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/setup.py 2022-03-07 18:58:58.000000000 -0300 -+++ b/setup.py 2022-04-14 22:25:18.860887901 -0300 -@@ -129,7 +129,7 @@ - # optional modules - - if BUILD_GSL: -- gsl = Extension('gsl', libraries = M_LIB + ['gsl'] + BLAS_LIB, -+ gsl = Extension('gsl', libraries = M_LIB + ['gsl', 'gslcblas'], - include_dirs = [ GSL_INC_DIR ], - library_dirs = [ GSL_LIB_DIR, BLAS_LIB_DIR ], - define_macros = GSL_MACROS, diff --git a/srcpkgs/python3-cvxopt/patches/test-modules.patch b/srcpkgs/python3-cvxopt/patches/test-modules.patch new file mode 100644 index 00000000000..6562b7e002e --- /dev/null +++ b/srcpkgs/python3-cvxopt/patches/test-modules.patch @@ -0,0 +1,76 @@ +diff --git a/tests/test_dsdp.py b/tests/test_dsdp.py +index d514dc8..2a5e5bf 100644 +--- a/tests/test_dsdp.py ++++ b/tests/test_dsdp.py +@@ -4,9 +4,10 @@ class TestDSDP(unittest.TestCase): + + def setUp(self): + try: +- from cvxopt import dsdp, matrix +- except: ++ import cvxopt.dsdp ++ except ModuleNotFoundError: + self.skipTest("DSDP not available") ++ from cvxopt import matrix + c = matrix([1.,-1.,1.]) + G = [ matrix([[-7., -11., -11., 3.], + [ 7., -18., -18., 8.], +diff --git a/tests/test_glpk.py b/tests/test_glpk.py +index 89f876d..dad5801 100644 +--- a/tests/test_glpk.py ++++ b/tests/test_glpk.py +@@ -4,15 +4,16 @@ class TestGLPK(unittest.TestCase): + + def setUp(self): + try: +- from cvxopt import glpk, matrix +- c = matrix([-4., -5.]) +- G = matrix([[2., 1., -1., 0.], [1., 2., 0., -1.]]) +- h = matrix([3., 3., 0., 0.]) +- A = matrix([1.0,1.0],(1,2)) +- b = matrix(1.0) +- self._prob_data = (c,G,h,A,b) +- except: ++ import cvxopt.glpk ++ except ModuleNotFoundError: + self.skipTest("GLPK not available") ++ from cvxopt import matrix ++ c = matrix([-4., -5.]) ++ G = matrix([[2., 1., -1., 0.], [1., 2., 0., -1.]]) ++ h = matrix([3., 3., 0., 0.]) ++ A = matrix([1.0,1.0],(1,2)) ++ b = matrix(1.0) ++ self._prob_data = (c,G,h,A,b) + + def test_lp(self): + from cvxopt import solvers, glpk +diff --git a/tests/test_gsl.py b/tests/test_gsl.py +index d24f058..3ee9a37 100644 +--- a/tests/test_gsl.py ++++ b/tests/test_gsl.py +@@ -4,8 +4,8 @@ class TestGSL(unittest.TestCase): + + def setUp(self): + try: +- from cvxopt import gsl +- except: ++ import cvxopt.gsl ++ except ModuleNotFoundError: + self.skipTest("GSL not available") + + def test1(self): +diff --git a/tests/test_mosek.py b/tests/test_mosek.py +index e3d0f4e..6cd1fbf 100644 +--- a/tests/test_mosek.py ++++ b/tests/test_mosek.py +@@ -4,8 +4,8 @@ class TestMOSEK(unittest.TestCase): + + def setUp(self): + try: +- from cvxopt import msk +- except: ++ import cvxopt.msk ++ except ModuleNotFoundError: + self.skipTest("MOSEK not available") + + def assertAlmostEqualLists(self,L1,L2,places=3): diff --git a/srcpkgs/python3-cvxopt/template b/srcpkgs/python3-cvxopt/template index 4044fbfea2a..944086e3783 100644 --- a/srcpkgs/python3-cvxopt/template +++ b/srcpkgs/python3-cvxopt/template @@ -1,11 +1,11 @@ # Template file for 'python3-cvxopt' pkgname=python3-cvxopt version=1.3.0 -revision=2 +revision=3 build_style=python3-module hostmakedepends="python3-setuptools" -makedepends="python3-devel blas-devel lapack-devel SuiteSparse-devel gsl-devel - glpk-devel fftw-devel" +makedepends="python3-devel SuiteSparse-devel gsl-devel glpk-devel fftw-devel + $(vopt_if openblas 'openblas-devel' 'lapack-devel')" checkdepends="python3-pytest" short_desc="Python software for convex optimization" maintainer="Gonzalo TornarĂ­a " @@ -14,8 +14,20 @@ homepage="http://cvxopt.org/" distfiles="${PYPI_SITE}/c/cvxopt/cvxopt-${version}.tar.gz" checksum=00b1b232f9d1f902d578a9d75814b67fa020758d5ae422e28ca8cef6269fa5c6 +build_options="openblas" + +case "$XBPS_TARGET_MACHINE" in + x86_64*|i686*|aarch64*|armv[67]*|ppc64*) + # Prefer accelerated routines where available + build_options_default="openblas" + ;; + *) ;; +esac + pre_build() { export CVXOPT_BUILD_GSL=1 export CVXOPT_BUILD_GLPK=1 export CVXOPT_BUILD_FFTW=1 + export CVXOPT_BLAS_LIB=$(vopt_if openblas 'openblas' 'blas;gslcblas') + export CVXOPT_LAPACK_LIB=$(vopt_if openblas 'openblas' 'lapack') }