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