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