1{ lib
2, buildPythonPackage
3, fetchPypi
4, isPyPy
5, python
6, openblasCompat # build segfaults with regular openblas
7, suitesparse
8, glpk ? null
9, gsl ? null
10, fftw ? null
11, withGlpk ? true
12, withGsl ? true
13, withFftw ? true
14}:
15
16buildPythonPackage rec {
17 pname = "cvxopt";
18 version = "1.2.0";
19
20 disabled = isPyPy; # hangs at [translation:info]
21
22 src = fetchPypi {
23 inherit pname version;
24 sha256 = "3296c9d49b7dcb894b20db5d7d1c1a443912b4d82358e03f836575e8398e0d60";
25 };
26
27 # similar to Gsl, glpk, fftw there is also a dsdp interface
28 # but dsdp is not yet packaged in nixpkgs
29 preConfigure = ''
30 export CVXOPT_BLAS_LIB_DIR=${openblasCompat}/lib
31 export CVXOPT_BLAS_LIB=openblas
32 export CVXOPT_LAPACK_LIB=openblas
33 export CVXOPT_SUITESPARSE_LIB_DIR=${suitesparse}/lib
34 export CVXOPT_SUITESPARSE_INC_DIR=${suitesparse}/include
35 '' + lib.optionalString withGsl ''
36 export CVXOPT_BUILD_GSL=1
37 export CVXOPT_GSL_LIB_DIR=${gsl}/lib
38 export CVXOPT_GSL_INC_DIR=${gsl}/include
39 '' + lib.optionalString withGlpk ''
40 export CVXOPT_BUILD_GLPK=1
41 export CVXOPT_GLPK_LIB_DIR=${glpk}/lib
42 export CVXOPT_GLPK_INC_DIR=${glpk}/include
43 '' + lib.optionalString withFftw ''
44 export CVXOPT_BUILD_FFTW=1
45 export CVXOPT_FFTW_LIB_DIR=${fftw}/lib
46 export CVXOPT_FFTW_INC_DIR=${fftw.dev}/include
47 '';
48
49 checkPhase = ''
50 ${python.interpreter} -m unittest discover -s tests
51 '';
52
53 meta = {
54 homepage = http://cvxopt.org/;
55 description = "Python Software for Convex Optimization";
56 longDescription = ''
57 CVXOPT is a free software package for convex optimization based on the
58 Python programming language. It can be used with the interactive
59 Python interpreter, on the command line by executing Python scripts,
60 or integrated in other software via Python extension modules. Its main
61 purpose is to make the development of software for convex optimization
62 applications straightforward by building on Python's extensive
63 standard library and on the strengths of Python as a high-level
64 programming language.
65 '';
66 maintainers = with lib.maintainers; [ edwtjo ];
67 license = lib.licenses.gpl3Plus;
68 };
69}