2023-02-02 18:25:31 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, isPyPy
|
|
|
|
, python
|
2023-02-02 18:25:31 +00:00
|
|
|
, openblas
|
2022-09-09 14:08:57 +00:00
|
|
|
, blas
|
|
|
|
, lapack # build segfaults with 64-bit blas
|
2020-04-24 23:36:52 +00:00
|
|
|
, suitesparse
|
2022-09-09 14:08:57 +00:00
|
|
|
, unittestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, glpk ? null
|
|
|
|
, gsl ? null
|
|
|
|
, fftw ? null
|
|
|
|
, withGlpk ? true
|
|
|
|
, withGsl ? true
|
|
|
|
, withFftw ? true
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert (!blas.isILP64) && (!lapack.isILP64);
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cvxopt";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "1.3.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
disabled = isPyPy; # hangs at [translation:info]
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-NGH6QsGyJAuk2h2YXKc1A5FBV/xMd0FzJ+1tfYWs2+Y=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
buildInputs = (if stdenv.isDarwin then [ openblas ] else [ blas lapack ]);
|
|
|
|
doCheck = !stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# similar to Gsl, glpk, fftw there is also a dsdp interface
|
|
|
|
# but dsdp is not yet packaged in nixpkgs
|
2023-02-02 18:25:31 +00:00
|
|
|
preConfigure = (if stdenv.isDarwin then
|
|
|
|
''
|
|
|
|
export CVXOPT_BLAS_LIB=openblas
|
|
|
|
export CVXOPT_LAPACK_LIB=openblas
|
|
|
|
''
|
|
|
|
else
|
|
|
|
''
|
2020-04-24 23:36:52 +00:00
|
|
|
export CVXOPT_BLAS_LIB=blas
|
|
|
|
export CVXOPT_LAPACK_LIB=lapack
|
2023-02-02 18:25:31 +00:00
|
|
|
'') +
|
|
|
|
''
|
|
|
|
export CVXOPT_BUILD_DSDP=0
|
2020-04-24 23:36:52 +00:00
|
|
|
export CVXOPT_SUITESPARSE_LIB_DIR=${lib.getLib suitesparse}/lib
|
|
|
|
export CVXOPT_SUITESPARSE_INC_DIR=${lib.getDev suitesparse}/include
|
|
|
|
'' + lib.optionalString withGsl ''
|
|
|
|
export CVXOPT_BUILD_GSL=1
|
2023-02-16 17:41:37 +00:00
|
|
|
export CVXOPT_GSL_LIB_DIR=${lib.getLib gsl}/lib
|
|
|
|
export CVXOPT_GSL_INC_DIR=${lib.getDev gsl}/include
|
2020-04-24 23:36:52 +00:00
|
|
|
'' + lib.optionalString withGlpk ''
|
|
|
|
export CVXOPT_BUILD_GLPK=1
|
2023-02-16 17:41:37 +00:00
|
|
|
export CVXOPT_GLPK_LIB_DIR=${lib.getLib glpk}/lib
|
|
|
|
export CVXOPT_GLPK_INC_DIR=${lib.getDev glpk}/include
|
2020-04-24 23:36:52 +00:00
|
|
|
'' + lib.optionalString withFftw ''
|
|
|
|
export CVXOPT_BUILD_FFTW=1
|
2023-02-16 17:41:37 +00:00
|
|
|
export CVXOPT_FFTW_LIB_DIR=${lib.getLib fftw}/lib
|
|
|
|
export CVXOPT_FFTW_INC_DIR=${lib.getDev fftw}/include
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ unittestCheckHook ];
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
unittestFlagsArray = [ "-s" "tests" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2023-11-16 04:20:00 +00:00
|
|
|
homepage = "https://cvxopt.org/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Python Software for Convex Optimization";
|
|
|
|
longDescription = ''
|
|
|
|
CVXOPT is a free software package for convex optimization based on the
|
|
|
|
Python programming language. It can be used with the interactive
|
|
|
|
Python interpreter, on the command line by executing Python scripts,
|
|
|
|
or integrated in other software via Python extension modules. Its main
|
|
|
|
purpose is to make the development of software for convex optimization
|
|
|
|
applications straightforward by building on Python's extensive
|
|
|
|
standard library and on the strengths of Python as a high-level
|
|
|
|
programming language.
|
|
|
|
'';
|
|
|
|
maintainers = with maintainers; [ edwtjo ];
|
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
};
|
|
|
|
}
|