1{ lib
2, buildPythonPackage
3, fetchPypi
4, isPyPy
5, python
6, blas
7, lapack # build segfaults with 64-bit blas
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.0";
23
24 disabled = isPyPy; # hangs at [translation:info]
25
26 src = fetchPypi {
27 inherit pname version;
28 sha256 = "sha256-ALGyMvnR+QLVeKnXWBS2f6AgdY1a5CLijKjO9iafpcY=";
29 };
30
31 buildInputs = [ blas lapack ];
32
33 # similar to Gsl, glpk, fftw there is also a dsdp interface
34 # but dsdp is not yet packaged in nixpkgs
35 preConfigure = ''
36 export CVXOPT_BLAS_LIB=blas
37 export CVXOPT_LAPACK_LIB=lapack
38 export CVXOPT_SUITESPARSE_LIB_DIR=${lib.getLib suitesparse}/lib
39 export CVXOPT_SUITESPARSE_INC_DIR=${lib.getDev suitesparse}/include
40 '' + lib.optionalString withGsl ''
41 export CVXOPT_BUILD_GSL=1
42 export CVXOPT_GSL_LIB_DIR=${gsl}/lib
43 export CVXOPT_GSL_INC_DIR=${gsl}/include
44 '' + lib.optionalString withGlpk ''
45 export CVXOPT_BUILD_GLPK=1
46 export CVXOPT_GLPK_LIB_DIR=${glpk}/lib
47 export CVXOPT_GLPK_INC_DIR=${glpk}/include
48 '' + lib.optionalString withFftw ''
49 export CVXOPT_BUILD_FFTW=1
50 export CVXOPT_FFTW_LIB_DIR=${fftw}/lib
51 export CVXOPT_FFTW_INC_DIR=${fftw.dev}/include
52 '';
53
54 checkInputs = [ unittestCheckHook ];
55
56 unittestFlagsArray = [ "-s" "tests" ];
57
58 meta = with lib; {
59 homepage = "http://cvxopt.org/";
60 description = "Python Software for Convex Optimization";
61 longDescription = ''
62 CVXOPT is a free software package for convex optimization based on the
63 Python programming language. It can be used with the interactive
64 Python interpreter, on the command line by executing Python scripts,
65 or integrated in other software via Python extension modules. Its main
66 purpose is to make the development of software for convex optimization
67 applications straightforward by building on Python's extensive
68 standard library and on the strengths of Python as a high-level
69 programming language.
70 '';
71 maintainers = with maintainers; [ edwtjo ];
72 license = licenses.gpl3Plus;
73 };
74}