1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchPypi,
6 isPyPy,
7 python,
8 blas,
9 lapack,
10 suitesparse,
11 unittestCheckHook,
12 glpk ? null,
13 gsl ? null,
14 fftw ? null,
15 withGlpk ? true,
16 withGsl ? true,
17 withFftw ? true,
18}:
19
20assert (!blas.isILP64) && (!lapack.isILP64);
21
22buildPythonPackage rec {
23 pname = "cvxopt";
24 version = "1.3.2";
25 format = "setuptools";
26
27 disabled = isPyPy; # hangs at [translation:info]
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-NGH6QsGyJAuk2h2YXKc1A5FBV/xMd0FzJ+1tfYWs2+Y=";
32 };
33
34 buildInputs = [
35 blas
36 lapack
37 ];
38
39 # similar to Gsl, glpk, fftw there is also a dsdp interface
40 # but dsdp is not yet packaged in nixpkgs
41 env =
42 {
43 CVXOPT_BLAS_LIB = "blas";
44 CVXOPT_LAPACK_LIB = "lapack";
45 CVXOPT_BUILD_DSDP = "0";
46 CVXOPT_SUITESPARSE_LIB_DIR = "${lib.getLib suitesparse}/lib";
47 CVXOPT_SUITESPARSE_INC_DIR = "${lib.getDev suitesparse}/include";
48 }
49 // lib.optionalAttrs withGsl {
50 CVXOPT_BUILD_GSL = "1";
51 CVXOPT_GSL_LIB_DIR = "${lib.getLib gsl}/lib";
52 CVXOPT_GSL_INC_DIR = "${lib.getDev gsl}/include";
53 }
54 // lib.optionalAttrs withGlpk {
55 CVXOPT_BUILD_GLPK = "1";
56 CVXOPT_GLPK_LIB_DIR = "${lib.getLib glpk}/lib";
57 CVXOPT_GLPK_INC_DIR = "${lib.getDev glpk}/include";
58 }
59 // lib.optionalAttrs withFftw {
60 CVXOPT_BUILD_FFTW = "1";
61 CVXOPT_FFTW_LIB_DIR = "${lib.getLib fftw}/lib";
62 CVXOPT_FFTW_INC_DIR = "${lib.getDev fftw}/include";
63 };
64
65 nativeCheckInputs = [ unittestCheckHook ];
66
67 unittestFlagsArray = [
68 "-s"
69 "tests"
70 ];
71
72 meta = with lib; {
73 homepage = "https://cvxopt.org/";
74 description = "Python Software for Convex Optimization";
75 longDescription = ''
76 CVXOPT is a free software package for convex optimization based on the
77 Python programming language. It can be used with the interactive
78 Python interpreter, on the command line by executing Python scripts,
79 or integrated in other software via Python extension modules. Its main
80 purpose is to make the development of software for convex optimization
81 applications straightforward by building on Python's extensive
82 standard library and on the strengths of Python as a high-level
83 programming language.
84 '';
85 maintainers = with maintainers; [ edwtjo ];
86 license = licenses.gpl3Plus;
87 };
88}