summaryrefslogtreecommitdiff
path: root/dev-python/cvxopt
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /dev-python/cvxopt
reinit the tree, so we can have metadata
Diffstat (limited to 'dev-python/cvxopt')
-rw-r--r--dev-python/cvxopt/Manifest12
-rw-r--r--dev-python/cvxopt/cvxopt-1.1.6-r2.ebuild99
-rw-r--r--dev-python/cvxopt/cvxopt-1.1.8.ebuild103
-rw-r--r--dev-python/cvxopt/cvxopt-1.1.9.ebuild103
-rw-r--r--dev-python/cvxopt/files/cvxopt-1.1.6-glpk449.patch1082
-rw-r--r--dev-python/cvxopt/files/cvxopt-1.1.6-setup.patch176
-rw-r--r--dev-python/cvxopt/files/cvxopt-1.1.8-setup.patch136
-rw-r--r--dev-python/cvxopt/metadata.xml23
8 files changed, 1734 insertions, 0 deletions
diff --git a/dev-python/cvxopt/Manifest b/dev-python/cvxopt/Manifest
new file mode 100644
index 000000000000..acd3a4412ade
--- /dev/null
+++ b/dev-python/cvxopt/Manifest
@@ -0,0 +1,12 @@
+AUX cvxopt-1.1.6-glpk449.patch 39362 SHA256 0289f6b4d726dc39b9a8ef1a8542ab355262fa291f14b0e6b33e14270fe72f59 SHA512 e494dbf0e6426f06fdbfc289caa541fdbc01451213e7700f9b51cc87f0d349eb869706112d8485149ba529f50f35e9b3cd0125ec2c0f27fd809b34b2f79d1dde WHIRLPOOL 5b7ba0067fbd582b55ef17c5400a795921cf6e96f5e01b741e74670cb3cd119cba88d4b09cfa111829816ab9b01d862f655c5fb95e267a9b5295c493d0a626e2
+AUX cvxopt-1.1.6-setup.patch 6312 SHA256 72a6c35b3bb20d655bbe1eb96e0abf1f9c253d82a1ae7094ef74eafd150b636b SHA512 ac89c43dafa66e41ef5608d1a8bdba2d94919303222778d8ca5fb266bd405e80f3ed7ca3ed7278ea0dfb65461d11c8adf0ce78772494aa8c0524d6eaca6456d9 WHIRLPOOL 55e6dc351f2e64fa88df8d3d72def2a87a2e8a78627118f73010839cfb0be707db8f0ab99ce3d0efdbcae964dac55ff5a2b63cd1e2b7ed197165942f012a6b8a
+AUX cvxopt-1.1.8-setup.patch 4586 SHA256 084b203e1bc9a477dbf6b1340da8ad8160ec5f9448f2afbf20f1e72dc2f1396f SHA512 b48179544527584fbed368b7140097bac81ca95327df3dc1a1d43d071c23c9c0745a4ccd0f4dd297c698f5b0cb44180b68f044a39dafbb8482ffba511b2c6d40 WHIRLPOOL d2c8e895d0b642cd6f9f38ca44cbccb648eaa65c3158bc730ce7200c46d2a10db6a1bdceeac14ac9686c303a4fd38405b551df6e816d012bfe2958129314e498
+DIST cvxopt-1.1.6.tar.gz 3352996 SHA256 7b4ccf3ed896dde6624623431c0b1f5e32d874384329ed716f51babcbf416227 SHA512 b9f5fd7870412423b60068d205efb99d3630012509cb659fb67a10d6175906768846d7c906cf2fcac4be29afd558619b71e2dca730041329195a2365dd1d722c WHIRLPOOL d43cf090ee0396a77851fb71e6e34c980152bccdd5fdb3ecc53d0a464a505ac87a1e7198d313ec669443970bcf8a2d616f03c2f861b7df2f620bd583a97ea140
+DIST cvxopt-1.1.8.tar.gz 5354013 SHA256 c96f8d01ae31a5bdec36a65b0587f50cfbf8139335adb70442350a8042da2025 SHA512 fdf047f203275e687c51b88575639ab0383207f8748969939ecf2939f9a2acc9f5d0e97c68377466fce81eb979b5eb058834f75134cc56df5dbb01805cb98c93 WHIRLPOOL 65c8a246e03a7136c2bce3c7ef831f9f82c4cc84b7a1e5db6a2643127ea9164c35782fb1013c0eaf7ac190d036887a131c705fa56b78bda179792eca9d016d8b
+DIST cvxopt-1.1.9.tar.gz 1872932 SHA256 09997fec809179c9bb9fe8cdd202ad6ecb675f890658219022f492e0797122ee SHA512 bb0982cd1489157df4c7cd0dd92bf83b1692dc3a27d6b9a7a465dda9f9daea4ea5ef69e48642a879d036679bd0b0fe0dfd782433ce4cc570e90e11823733e58b WHIRLPOOL c9ba8b674dbcf1799a99559f3794db2cf8f57f5584865294fea5ee6932d59a9d9980e10197e8e4cd291d591bad9d92b24737a909b5bac6f6617597afa057c171
+EBUILD cvxopt-1.1.6-r2.ebuild 2521 SHA256 53267571e617eefd11203731a13db2f7f5a8e63f60681170f5054ffabdc50632 SHA512 f3121534347fb0fa66fa74986c169cf09236b6f193f26b18127fd76bac877583fbe6c2fd3123471eaac5df58249aaa9bbb4a82245d5e7c9b5b646a84488b868b WHIRLPOOL 6495278f900f534b7ba3c5d5e6035a2c62c75761f60730124ead9879f9e6614b903a23bb9e868043994d3b7a37438747423fe4fdca48346f458b2e6992565b65
+EBUILD cvxopt-1.1.8.ebuild 2572 SHA256 2e0af090496e210c1e55f82ff5323974c523f39ed1f5bccb6625cb51a97d7a0c SHA512 464be47edb5993512da0cf9f94ed40a767d6806cb5b99427e202d1e89c893c89c45111f11643496ae606a4a73538a4f17a8a0562440b9f26d86d9874a568d453 WHIRLPOOL fe6de5bbfb96961277b6cc44fab4d1cc2542ff5fdc22fe3a421764f8ddf130341b8d83dddefaa01ec672f4a0d306478316bb97f9d5b7fc60fcf0127c794b6ab4
+EBUILD cvxopt-1.1.9.ebuild 2887 SHA256 9c98caa3c4de9355c3b5fd2e448187012f291250a91ae4af9f43e72db936e3e6 SHA512 647370781d4b3bcaadcd6b08b25c17340f73c428ccf1da6d659955e52d762694404028e61bf5cb0572778dc11b11185b57538c19078537e61c53cf47fd0a5a90 WHIRLPOOL 17735a78d7952cb124bbc56f38a0ac7346784cc67421de51c38ca2548de5b8abb98a3404f0da46074584c7f636e30df50348b9fb04d8d12646af136754aa25b5
+MISC ChangeLog 3698 SHA256 ecd2235276d2052d192048730e4d6f7e10d39525b07224cb6e0f4b750a38670a SHA512 fd1ca459df6abfa79925f33b677d38742650cd3f6702b5acb0467a390afd73cc00a5fc76be163748e3808376c33bcd72ffaa2751745344d361839730806c48f8 WHIRLPOOL 032d10228d17c8ec458ca9bc02566f61a76fbf2cba322e5a43fae177b003511fbc6fc34091450eb4fbf59eaee96b46b7706c5a4f4724cc9ab6681bbf7a822387
+MISC ChangeLog-2015 5833 SHA256 5e1397f9388b0ae89ad699fe7b5e7fd743292144ecd77f2bb72f1398b2534935 SHA512 9d1577314be6b3a5f26e7c16bcd8f01577d3bec9994fbc0e49b27550c9e2e152099eb8263cfe29c6da4009f0c1204ffb8741963ed520f86a1b5e95567c9e27cd WHIRLPOOL 2e650decef5f7fc0a656caf806c46a6d113c5c1a6211383ea85178aa38c3aa1e65f186ed634bdb51320cf099ac15d81fe30a716fddd9e61073bacedbcf4c15aa
+MISC metadata.xml 805 SHA256 607cadf1804415f92f442f404dbebd5fd444ce24e7f855f222aa82c50e242b66 SHA512 52bdd0bdc12807d7a3d2d820af3167b0768225167377bdf42e5f7218d5154deab2bee8bbcfdd173301e4b1d87f268bfb4bf6c1f884113c2d1f3fbf7fa1dc2ab6 WHIRLPOOL a6a9abee6437bcf1f880678c79acf7f973a989bf1baf6a15e2a2eedd853f5363b029abad12358d8e499a3957ce4a4dcd903590889393c51214c52eb80508352b
diff --git a/dev-python/cvxopt/cvxopt-1.1.6-r2.ebuild b/dev-python/cvxopt/cvxopt-1.1.6-r2.ebuild
new file mode 100644
index 000000000000..c83a21f9e4b9
--- /dev/null
+++ b/dev-python/cvxopt/cvxopt-1.1.6-r2.ebuild
@@ -0,0 +1,99 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+PYTHON_COMPAT=( python{2_7,3_4} )
+
+inherit distutils-r1 toolchain-funcs eutils
+
+DESCRIPTION="Python package for convex optimization"
+HOMEPAGE="http://cvxopt.org/"
+SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc +dsdp examples fftw +glpk gsl"
+
+RDEPEND="
+ virtual/blas
+ virtual/cblas
+ virtual/lapack
+ sci-libs/cholmod:0=
+ sci-libs/umfpack:0=
+ dsdp? ( sci-libs/dsdp:0= )
+ fftw? ( sci-libs/fftw:3.0= )
+ glpk? ( sci-mathematics/glpk:0= )
+ gsl? ( sci-libs/gsl:0= )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? ( dev-python/sphinx )"
+
+python_prepare_all(){
+ epatch "${FILESDIR}"/${PN}-1.1.6-setup.patch
+
+ has_version ">=sci-mathematics/glpk-4.49" && \
+ epatch "${FILESDIR}"/${PN}-1.1.6-glpk449.patch
+
+ rm -r src/C/SuiteSparse*/ || die
+
+ pkg_lib() {
+ local pkg=$(echo $1 | tr '[:lower:]' '[:upper:]')
+ local libs="$($(tc-getPKG_CONFIG) --libs-only-l $1 | \
+ sed -e 's:[ ]-l*\(pthread\|m\)\([ ]\|$\)::g' -e 's:[ ]*$::' | \
+ tr ' ' '\n' | sort -u | sed -e "s:^-l\(.*\):'\1':g" | \
+ tr '\n' ',' | sed -e 's:,$::')"
+ local libdir="$($(tc-getPKG_CONFIG) --libs-only-L $1 | \
+ sed -e 's:[ ]*$::' | \
+ tr ' ' '\n' | sort -u | sed -e "s:^-L\(.*\):'\1':g" | \
+ tr '\n' ',' | sed -e 's:,$::')"
+ local incdir="$($(tc-getPKG_CONFIG) --cflags-only-I $1 | \
+ sed -e 's:[ ]*$::' | \
+ tr ' ' '\n' | sort -u | sed -e "s:^-L\(.*\):'\1':g" | \
+ tr '\n' ',' | sed -e 's:,$::')"
+ sed -i \
+ -e "/${pkg}_LIB[ ]*=/s:\(.*[ ]*=[ ]*\[\).*${1}.*:\1${libs}\]:" \
+ -e "s:\(${pkg}_INC_DIR[ ]*=\).*$:\1 ${incdir}:" \
+ -e "s:\[ BLAS_LIB_DIR \]:\[ ${libdir} \]:g" \
+ setup.py || die
+ }
+
+ use_cvx() {
+ local flag=$1
+ if use ${flag} ; then
+ # Switch to ^^ when we switch to EAPI=6.
+ #local uflag=${flag^^}
+ local uflag=$(tr '[:lower:]' '[:upper:]' <<<"${flag}")
+ sed -i \
+ -e "s/\(BUILD_${uflag} =\) 0/\1 1/" \
+ setup.py || die
+ fi
+ }
+
+ pkg_lib blas
+ pkg_lib lapack
+
+ use_cvx gsl
+ use_cvx fftw
+ use_cvx glpk
+ use_cvx dsdp
+
+ distutils-r1_python_prepare_all
+}
+
+python_compile_all() {
+ use doc && export VARTEXFONTS="${T}/fonts" && emake -C doc -B html
+}
+
+python_test() {
+ cd examples/doc/chap8
+ "${EPYTHON}" lp.py || die
+}
+
+python_install_all() {
+ use doc && HTML_DOCS=( doc/build/html/. )
+ insinto /usr/share/doc/${PF}
+ use examples && doins -r examples
+ distutils-r1_python_install_all
+}
diff --git a/dev-python/cvxopt/cvxopt-1.1.8.ebuild b/dev-python/cvxopt/cvxopt-1.1.8.ebuild
new file mode 100644
index 000000000000..a4a23ecac408
--- /dev/null
+++ b/dev-python/cvxopt/cvxopt-1.1.8.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 python3_{4,5} )
+
+inherit distutils-r1 eutils toolchain-funcs
+
+DESCRIPTION="Python package for convex optimization"
+HOMEPAGE="http://cvxopt.org/"
+SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc +dsdp examples fftw +glpk gsl"
+
+RDEPEND="
+ virtual/blas
+ virtual/cblas
+ virtual/lapack
+ sci-libs/amd:0=
+ sci-libs/cholmod:0=
+ sci-libs/colamd:0=
+ sci-libs/suitesparseconfig:0=
+ sci-libs/umfpack:0=
+ dsdp? ( sci-libs/dsdp:0= )
+ fftw? ( sci-libs/fftw:3.0= )
+ glpk? ( >=sci-mathematics/glpk-4.49:0= )
+ gsl? ( sci-libs/gsl:0= )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? ( dev-python/sphinx )"
+
+python_prepare_all(){
+ epatch "${FILESDIR}"/${P}-setup.patch
+
+ rm -r src/C/SuiteSparse*/ || die
+
+ pkg_lib() {
+ local pkg=$(echo $1 | tr '[:lower:]' '[:upper:]')
+ local libs="$($(tc-getPKG_CONFIG) --libs-only-l $1 | \
+ sed -e 's:[ ]-l*\(pthread\|m\)\([ ]\|$\)::g' -e 's:[ ]*$::' | \
+ tr ' ' '\n' | sort -u | sed -e "s:^-l\(.*\):'\1':g" | \
+ tr '\n' ',' | sed -e 's:,$::')"
+ local libdir="$($(tc-getPKG_CONFIG) --libs-only-L $1 | \
+ sed -e 's:[ ]*$::' | \
+ tr ' ' '\n' | sort -u | sed -e "s:^-L\(.*\):'\1':g" | \
+ tr '\n' ',' | sed -e 's:,$::')"
+ local incdir="$($(tc-getPKG_CONFIG) --cflags-only-I $1 | \
+ sed -e 's:[ ]*$::' | \
+ tr ' ' '\n' | sort -u | sed -e "s:^-L\(.*\):'\1':g" | \
+ tr '\n' ',' | sed -e 's:,$::')"
+ sed -i \
+ -e "/${pkg}_LIB[ ]*=/s:\(.*[ ]*=[ ]*\[\).*${1}.*:\1${libs}\]:" \
+ -e "s:\(${pkg}_INC_DIR[ ]*=\).*$:\1 ${incdir}:" \
+ -e "s:\[ BLAS_LIB_DIR \]:\[ ${libdir} \]:g" \
+ setup.py || die
+ }
+
+ use_cvx() {
+ local flag=$1
+ if use ${flag} ; then
+ # Switch to ^^ when we switch to EAPI=6.
+ #local uflag=${flag^^}
+ local uflag=$(tr '[:lower:]' '[:upper:]' <<<"${flag}")
+ sed -i \
+ -e "s/\(BUILD_${uflag} =\) 0/\1 1/" \
+ setup.py || die
+ fi
+ }
+
+ pkg_lib blas
+ pkg_lib lapack
+
+ use_cvx gsl
+ use_cvx fftw
+ use_cvx glpk
+ use_cvx dsdp
+
+ sed \
+ -e '/SUITESPARSE_EXT_LIB/s:0:1:g' \
+ -i setup.py || die
+
+ distutils-r1_python_prepare_all
+}
+
+python_compile_all() {
+ use doc && export VARTEXFONTS="${T}/fonts" && emake -C doc -B html
+}
+
+python_test() {
+ cd examples/doc/chap8
+ "${EPYTHON}" lp.py || die
+}
+
+python_install_all() {
+ use doc && HTML_DOCS=( doc/build/html/. )
+ insinto /usr/share/doc/${PF}
+ use examples && EXAMPLES=( examples/. )
+ distutils-r1_python_install_all
+}
diff --git a/dev-python/cvxopt/cvxopt-1.1.9.ebuild b/dev-python/cvxopt/cvxopt-1.1.9.ebuild
new file mode 100644
index 000000000000..34b3f873e26e
--- /dev/null
+++ b/dev-python/cvxopt/cvxopt-1.1.9.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 python3_{4,5} )
+
+inherit distutils-r1 toolchain-funcs
+
+DESCRIPTION="Python package for convex optimization"
+HOMEPAGE="http://cvxopt.org/"
+SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc +dsdp examples fftw +glpk gsl"
+
+RDEPEND="
+ virtual/blas
+ virtual/lapack
+ sci-libs/amd:0=
+ sci-libs/cholmod:0=
+ sci-libs/colamd:0=
+ sci-libs/suitesparseconfig:0=
+ sci-libs/umfpack:0=
+ dsdp? ( sci-libs/dsdp:0= )
+ fftw? ( sci-libs/fftw:3.0= )
+ glpk? ( >=sci-mathematics/glpk-4.49:0= )
+ gsl? ( sci-libs/gsl:0= )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? ( dev-python/sphinx )"
+
+python_prepare_all(){
+ pkg_libs() {
+ $(tc-getPKG_CONFIG) --libs-only-l $* | \
+ sed -e 's:[ ]-l*\(pthread\|m\)\([ ]\|$\)::g' -e 's:[ ]*$::' | \
+ tr ' ' '\n' | sort -u | sed -e "s:^-l\(.*\):\1:g" | \
+ tr '\n' ';' | sed -e 's:;$::'
+ }
+ pkg_libdir() {
+ $(tc-getPKG_CONFIG) --libs-only-L $* | \
+ sed -e 's:[ ]*$::' | \
+ tr ' ' '\n' | sort -u | sed -e "s:^-L\(.*\):\1:g" | \
+ tr '\n' ';' | sed -e 's:;$::'
+ }
+ pkg_incdir() {
+ $(tc-getPKG_CONFIG) --cflags-only-I $* | \
+ sed -e 's:[ ]*$::' | \
+ tr ' ' '\n' | sort -u | sed -e "s:^-I\(.*\):\1:g" | \
+ tr '\n' ';' | sed -e 's:,$::'
+ }
+
+ # mandatory dependencies
+ export CVXOPT_BLAS_LIB="$(pkg_libs blas)"
+ export CVXOPT_BLAS_LIB_DIR="$(pkg_libdir blas)"
+ export CVXOPT_LAPACK_LIB="$(pkg_libs lapack)"
+ export CVXOPT_SUITESPARSE_LIB_DIR="$(pkg_libdir umfpack cholmod amd colamd suitesparseconfig)"
+ export CVXOPT_SUITESPARSE_INC_DIR="$(pkg_incdir umfpack cholmod amd colamd suitesparseconfig)"
+
+ # optional dependencies
+ use dsdp && \
+ export CVXOPT_BUILD_DSDP=1 && \
+ export CVXOPT_DSDP_LIB_DIR="${EPREFIX}/usr/$(get_libdir)" && \
+ export CVXOPT_DSDP_INC_DIR="${EPREFIX}/usr/include"
+
+ use fftw && \
+ export CVXOPT_BUILD_FFTW=1 && \
+ export CVXOPT_FFTW_LIB_DIR="$(pkg_libdir fftw3)" && \
+ export CVXOPT_FFTW_INC_DIR="$(pkg_incdir fftw3)"
+
+ use glpk && \
+ export CVXOPT_BUILD_GLPK=1 && \
+ export CVXOPT_GLPK_LIB_DIR="${EPREFIX}/usr/$(get_libdir)" && \
+ export CVXOPT_GLPK_INC_DIR="${EPREFIX}/usr/include"
+
+ use gsl && \
+ export CVXOPT_BUILD_GSL=1 && \
+ export CVXOPT_GSL_LIB_DIR="$(pkg_libdir gsl)" && \
+ export CVXOPT_GSL_INC_DIR="$(pkg_incdir gsl)"
+
+ distutils-r1_python_prepare_all
+}
+
+python_compile_all() {
+ use doc && VARTEXFONTS="${T}/fonts" emake -C doc -B html
+}
+
+python_test() {
+ PYTHONPATH="${BUILD_DIR}"/lib nosetests -v || die
+}
+
+python_install_all() {
+ use doc && HTML_DOCS=( doc/build/html/. )
+ insinto /usr/share/doc/${PF}
+ distutils-r1_python_install_all
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r examples
+ docompress -x /usr/share/doc/${PF}/examples
+ fi
+}
diff --git a/dev-python/cvxopt/files/cvxopt-1.1.6-glpk449.patch b/dev-python/cvxopt/files/cvxopt-1.1.6-glpk449.patch
new file mode 100644
index 000000000000..2a1cc6737be4
--- /dev/null
+++ b/dev-python/cvxopt/files/cvxopt-1.1.6-glpk449.patch
@@ -0,0 +1,1082 @@
+--- src/C/glpk.c.orig 2014-03-24 09:39:39.510214726 -0700
++++ src/C/glpk.c 2014-03-24 09:38:41.251897138 -0700
+@@ -23,75 +23,271 @@
+ #include "misc.h"
+ #include "glpk.h"
+
++
+ PyDoc_STRVAR(glpk__doc__,
+ "Interface to the simplex and mixed integer LP algorithms in GLPK.\n\n"
+ "The GLPK control parameters have the default values listed in \n"
+- "the GLPK documentation, except for 'LPX_K_PRESOL', which is set\n"
++ "the GLPK documentation, except for 'presolve', which is set\n"
+ "to 1 and cannot be modified. The other parameters can be\n"
+- "modified by making an entry in the dictionary glpk.options.\n"
+- "For example, the command glpk.options['LPX_K_MSGLEV'] = 0 turns\n"
+- "off the printed output during execution of glpk.simplex().\n"
++ "modified by passing a smcp or iocp object to the appropriate function\n"
++ "For example, the commands param = glpk.smcp(msg_lev = 0), or \n"
++ "param=glpk.smcp(); param.msg_lev=1 turn off the printed output during"
++ " execution of glpk.simplex().\n"
+ "See the documentation at www.gnu.org/software/glpk/glpk.html for\n"
+ "the list of GLPK control parameters and their default values.");
+
+ static PyObject *glpk_module;
+
+-typedef struct {
+- char name[20];
+- int idx;
+- char type;
+-} param_tuple;
+-
+-static const param_tuple GLPK_PARAM_LIST[] = {
+- {"LPX_K_MSGLEV", LPX_K_MSGLEV, 'i'},
+- {"LPX_K_SCALE", LPX_K_SCALE, 'i'},
+- {"LPX_K_DUAL", LPX_K_DUAL, 'i'},
+- {"LPX_K_PRICE", LPX_K_PRICE, 'i'},
+- {"LPX_K_RELAX", LPX_K_RELAX, 'f'},
+- {"LPX_K_TOLBND", LPX_K_TOLBND, 'f'},
+- {"LPX_K_TOLDJ", LPX_K_TOLDJ, 'f'},
+- {"LPX_K_TOLPIV", LPX_K_TOLPIV, 'f'},
+- {"LPX_K_ROUND", LPX_K_ROUND, 'i'},
+- {"LPX_K_OBJLL", LPX_K_OBJLL, 'f'},
+- {"LPX_K_OBJUL", LPX_K_OBJUL, 'f'},
+- {"LPX_K_ITLIM", LPX_K_ITLIM, 'i'},
+- {"LPX_K_ITCNT", LPX_K_ITCNT, 'i'},
+- {"LPX_K_TMLIM", LPX_K_TMLIM, 'f'},
+- {"LPX_K_OUTFRQ", LPX_K_OUTFRQ, 'i'},
+- {"LPX_K_OUTDLY", LPX_K_OUTDLY, 'f'},
+- {"LPX_K_BRANCH", LPX_K_BRANCH, 'i'},
+- {"LPX_K_BTRACK", LPX_K_BTRACK, 'i'},
+- {"LPX_K_TOLINT", LPX_K_TOLINT, 'f'},
+- {"LPX_K_TOLOBJ", LPX_K_TOLOBJ, 'f'},
+- {"LPX_K_MPSINFO", LPX_K_MPSINFO, 'i'},
+- {"LPX_K_MPSOBJ", LPX_K_MPSOBJ, 'i'},
+- {"LPX_K_MPSORIG", LPX_K_MPSORIG, 'i'},
+- {"LPX_K_MPSWIDE", LPX_K_MPSWIDE, 'i'},
+- {"LPX_K_MPSFREE", LPX_K_MPSFREE, 'i'},
+- {"LPX_K_MPSSKIP", LPX_K_MPSSKIP, 'i'},
+- {"LPX_K_LPTORIG", LPX_K_LPTORIG, 'i'},
+- {"LPX_K_PRESOL", LPX_K_PRESOL, 'i'},
+-}; /* 28 paramaters */
++/* Wrappers around the option glpk structs */
++typedef struct{
++ PyObject_HEAD
++ glp_smcp obj;
++} pysmcp;
+
++/* Deallocation of smcp object */
++static void smcp_dealloc(pysmcp* self)
++{
++ Py_TYPE(self)->tp_free((PyObject*)self);
++}
+
+-#if PY_MAJOR_VERSION >= 3
+-static int get_param_idx(const char *str, int *idx, char *type)
+-#else
+-static int get_param_idx(char *str, int *idx, char *type)
+-#endif
++/* New smcp method */
++static PyObject *
++smcp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+ {
+- int i;
++ pysmcp *self;
++ self = (pysmcp *)type->tp_alloc(type, 0);
++ return (PyObject *)self;
++}
++
++/* Initialisation of smcp object */
++static int
++smcp_init(pysmcp *self, PyObject *args, PyObject *kwds)
++{
++ /*static char *kwlist[] = {"number", NULL};*/
++ static char *kwlist[] = { "msg_lev", "meth", "pricing", "r_test", "tol_bnd", "tol_dj", "tol_piv", "obj_ll", "obj_ul", "it_lim", "tm_lim", "out_frq", "out_dly", "presolve" };
++ glp_init_smcp(&self->obj);
++ if (! PyArg_ParseTupleAndKeywords(args, kwds, "|iiiidddddiiiii", kwlist,
++ &self->obj.msg_lev,
++ &self->obj.meth,
++ &self->obj.pricing,
++ &self->obj.r_test,
++ &self->obj.tol_bnd,
++ &self->obj.tol_dj,
++ &self->obj.tol_piv,
++ &self->obj.obj_ll,
++ &self->obj.obj_ul,
++ &self->obj.it_lim,
++ &self->obj.tm_lim,
++ &self->obj.out_frq,
++ &self->obj.out_dly,
++ &self->obj.presolve))
++ return -1;
+
+- for (i=0; i<28; i++) {
+- if (!strcmp(GLPK_PARAM_LIST[i].name, str)) {
+- *idx = GLPK_PARAM_LIST[i].idx;
+- *type = GLPK_PARAM_LIST[i].type;
+- return 1;
+- }
+- }
+ return 0;
+ }
+
++/* smcp members declaration */
++static PyMemberDef smcpMembers[] = {
++ {"msg_lev", T_INT, offsetof(pysmcp,obj)+offsetof(glp_smcp,msg_lev), 0, "message level: "},
++ {"meth", T_INT, offsetof(pysmcp,obj)+offsetof(glp_smcp,meth), 0, "simplex method option: "},
++ {"pricing", T_INT, offsetof(pysmcp,obj)+offsetof(glp_smcp,pricing), 0, "pricing technique: "},
++ {"r_test", T_INT, offsetof(pysmcp,obj)+offsetof(glp_smcp,r_test), 0, "ratio test technique: "},
++ {"tol_bnd", T_DOUBLE, offsetof(pysmcp,obj)+offsetof(glp_smcp,tol_bnd), 0, "spx.tol_bnd "},
++ {"tol_dj", T_DOUBLE, offsetof(pysmcp,obj)+offsetof(glp_smcp,tol_dj), 0, "spx.tol_dj "},
++ {"tol_piv", T_DOUBLE, offsetof(pysmcp,obj)+offsetof(glp_smcp,tol_piv), 0, "spx.tol_piv "},
++ {"obj_ll", T_DOUBLE, offsetof(pysmcp,obj)+offsetof(glp_smcp,obj_ll), 0, "spx.obj_ll "},
++ {"obj_ul", T_DOUBLE, offsetof(pysmcp,obj)+offsetof(glp_smcp,obj_ul), 0, "spx.obj_ul "},
++ {"it_lim", T_INT, offsetof(pysmcp,obj)+offsetof(glp_smcp,it_lim), 0, "spx.it_lim "},
++ {"tm_lim", T_INT, offsetof(pysmcp,obj)+offsetof(glp_smcp,tm_lim), 0, "spx.tm_lim (milliseconds) "},
++ {"out_frq", T_INT, offsetof(pysmcp,obj)+offsetof(glp_smcp,out_frq), 0, "spx.out_frq "},
++ {"out_dly", T_INT, offsetof(pysmcp,obj)+offsetof(glp_smcp,out_dly), 0, "spx.out_dly (milliseconds) "},
++ {"presolve", T_INT, offsetof(pysmcp,obj)+offsetof(glp_smcp,presolve), 0, "enable/disable using LP presolver "},
++};
++
++static PyTypeObject smcp_t = {
++ PyVarObject_HEAD_INIT(NULL, 0)
++ "glpk.smcp", /* tp_name */
++ sizeof(pysmcp), /* tp_basicsize */
++ 0, /* tp_itemsize */
++ (destructor)smcp_dealloc, /* tp_dealloc */
++ 0, /* tp_print */
++ 0, /* tp_getattr */
++ 0, /* tp_setattr */
++ 0, /* tp_reserved */
++ 0, /* tp_repr */
++ 0, /* tp_as_number */
++ 0, /* tp_as_sequence */
++ 0, /* tp_as_mapping */
++ 0, /* tp_hash */
++ 0, /* tp_call */
++ 0, /* tp_str */
++ 0, /* tp_getattro */
++ 0, /* tp_setattro */
++ 0, /* tp_as_buffer */
++ Py_TPFLAGS_DEFAULT |
++ Py_TPFLAGS_BASETYPE, /* tp_flags */
++ "simplex method control parameters", /* tp_doc */
++ 0, /* tp_traverse */
++ 0, /* tp_clear */
++ 0, /* tp_richcompare */
++ 0, /* tp_weaklistoffset */
++ 0, /* tp_iter */
++ 0, /* tp_iternext */
++ 0, /* tp_methods */
++ smcpMembers, /* tp_members */
++ 0, /* tp_getset */
++ 0, /* tp_base */
++ 0, /* tp_dict */
++ 0, /* tp_descr_get */
++ 0, /* tp_descr_set */
++ 0, /* tp_dictoffset */
++ (initproc)smcp_init, /* tp_init */
++ 0, /* tp_alloc */
++ smcp_new, /* tp_new */
++};
++
++
++/* Wrappers around the option glpk structs */
++typedef struct{
++ PyObject_HEAD
++ glp_iocp obj;
++} pyiocp;
++
++/* Deallocation of iocp object */
++static void iocp_dealloc(pysmcp* self)
++{
++ Py_TYPE(self)->tp_free((PyObject*)self);
++}
++
++/* New iocp method */
++static PyObject *
++iocp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
++{
++ pyiocp *self;
++ self = (pyiocp *)type->tp_alloc(type, 0);
++ return (PyObject *)self;
++}
++
++/* Initialisation of iocp object */
++static int
++iocp_init(pyiocp *self, PyObject *args, PyObject *kwds)
++{
++ /*static char *kwlist[] = {"number", NULL};*/
++ static char *kwlist[] = { "msg_lev", "br_tech", "bt_tech", "tol_int", "tol_obj", "tm_lim", "out_frq", "out_dly", "cb_size", "pp_tech", "mip_gap", "mir_cuts", "gmi_cuts", "cov_cuts", "clq_cuts", "presolve", "binarize", "fp_heur", "ps_heur", "ps_tm_lim", "use_sol", "save_sol", "alien",NULL};
++ glp_init_iocp(&self->obj);
++
++ if (! PyArg_ParseTupleAndKeywords(args, kwds, "|iiiddiiiiidiiiiiiiiiisi", kwlist,
++ &self->obj.msg_lev,
++ &self->obj.br_tech,
++ &self->obj.bt_tech,
++ &self->obj.tol_int,
++ &self->obj.tol_obj,
++ &self->obj.tm_lim,
++ &self->obj.out_frq,
++ &self->obj.out_dly,
++ &self->obj.cb_size,
++ &self->obj.pp_tech,
++ &self->obj.mip_gap,
++ &self->obj.mir_cuts,
++ &self->obj.gmi_cuts,
++ &self->obj.cov_cuts,
++ &self->obj.clq_cuts,
++ &self->obj.presolve,
++ &self->obj.binarize,
++ &self->obj.fp_heur,
++ &self->obj.ps_heur,
++ &self->obj.ps_tm_lim,
++ &self->obj.use_sol,
++ &self->obj.save_sol,
++ &self->obj.alien))
++ return -1;
++
++ return 0;
++}
++
++/* iocp members declaration */
++static PyMemberDef iocpMembers[] = {
++ {"msg_lev", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,msg_lev), 0, "message level (see glp_smcp) "},
++ {"br_tech", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,br_tech), 0, "branching technique: "},
++ {"bt_tech", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,bt_tech), 0, "backtracking technique: "},
++ {"tol_int", T_DOUBLE, offsetof(pysmcp,obj)+offsetof(glp_iocp,tol_int), 0, "mip.tol_int "},
++ {"tol_obj", T_DOUBLE, offsetof(pysmcp,obj)+offsetof(glp_iocp,tol_obj), 0, "mip.tol_obj "},
++ {"tm_lim", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,tm_lim), 0, "mip.tm_lim (milliseconds) "},
++ {"out_frq", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,out_frq), 0, "mip.out_frq (milliseconds) "},
++ {"out_dly", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,out_dly), 0, "mip.out_dly (milliseconds) "},
++ /*void (*cb_func)(glp_tree *T, void *info); [> mip.cb_func <]*/
++ /*void *cb_info; [> mip.cb_info <]*/
++ {"cb_size", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,cb_size), 0, "mip.cb_size "},
++ {"pp_tech", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,pp_tech), 0, "preprocessing technique: "},
++ {"mip_gap", T_DOUBLE, offsetof(pysmcp,obj)+offsetof(glp_iocp,mip_gap), 0, "relative MIP gap tolerance "},
++ {"mir_cuts", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,mir_cuts), 0, "MIR cuts (GLP_ON/GLP_OFF) "},
++ {"gmi_cuts", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,gmi_cuts), 0, "Gomory's cuts (GLP_ON/GLP_OFF) "},
++ {"cov_cuts", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,cov_cuts), 0, "cover cuts (GLP_ON/GLP_OFF) "},
++ {"clq_cuts", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,clq_cuts), 0, "clique cuts (GLP_ON/GLP_OFF) "},
++ {"presolve", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,presolve), 0, "enable/disable using MIP presolver "},
++ {"binarize", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,binarize), 0, "try to binarize integer variables "},
++ {"fp_heur", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,fp_heur), 0, "feasibility pump heuristic "},
++ {"ps_heur", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,ps_heur), 0, "proximity search heuristic "},
++ {"ps_tm_lim", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,ps_tm_lim), 0, "proxy time limit, milliseconds "},
++ {"use_sol", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,use_sol), 0, "use existing solution "},
++ {"save_sol",T_STRING,offsetof(pysmcp,obj)+offsetof(glp_iocp,save_sol),0, "filename to save every new solution"},
++ {"alien", T_INT, offsetof(pysmcp,obj)+offsetof(glp_iocp,alien), 0, "use alien solver "},
++};
++
++static PyTypeObject iocp_t = {
++ PyVarObject_HEAD_INIT(NULL, 0)
++ "glpk.iocp", /* tp_name */
++ sizeof(pyiocp), /* tp_basicsize */
++ 0, /* tp_itemsize */
++ (destructor)iocp_dealloc, /* tp_dealloc */
++ 0, /* tp_print */
++ 0, /* tp_getattr */
++ 0, /* tp_setattr */
++ 0, /* tp_reserved */
++ 0, /* tp_repr */
++ 0, /* tp_as_number */
++ 0, /* tp_as_sequence */
++ 0, /* tp_as_mapping */
++ 0, /* tp_hash */
++ 0, /* tp_call */
++ 0, /* tp_str */
++ 0, /* tp_getattro */
++ 0, /* tp_setattro */
++ 0, /* tp_as_buffer */
++ Py_TPFLAGS_DEFAULT |
++ Py_TPFLAGS_BASETYPE, /* tp_flags */
++ "integer optimizer control parameters", /* tp_doc */
++ 0, /* tp_traverse */
++ 0, /* tp_clear */
++ 0, /* tp_richcompare */
++ 0, /* tp_weaklistoffset */
++ 0, /* tp_iter */
++ 0, /* tp_iternext */
++ 0, /* tp_methods */
++ iocpMembers, /* tp_members */
++ 0, /* tp_getset */
++ 0, /* tp_base */
++ 0, /* tp_dict */
++ 0, /* tp_descr_get */
++ 0, /* tp_descr_set */
++ 0, /* tp_dictoffset */
++ (initproc)iocp_init, /* tp_init */
++ 0, /* tp_alloc */
++ iocp_new, /* tp_new */
++};
++
++
++
++/* Small helper function to generate the output string of the simplex function */
++inline static void set_output_string(PyObject* t,const char s[]) {
++ PyTuple_SET_ITEM(t, 0, (PyObject *)
++#if PY_MAJOR_VERSION >= 3
++ PyUnicode_FromString(s));
++#else
++ PyString_FromString(s));
++#endif
++ }
++
+
+ static char doc_simplex[] =
+ "Solves a linear program using GLPK.\n\n"
+@@ -126,21 +322,16 @@
+ PyObject *kwrds)
+ {
+ matrix *c, *h, *b=NULL, *x=NULL, *z=NULL, *y=NULL;
+- PyObject *G, *A=NULL, *t=NULL, *param, *key, *value;
+- LPX *lp;
+- int m, n, p, i, j, k, nnz, nnzmax, *rn=NULL, *cn=NULL, param_id;
+- int_t pos=0;
++ PyObject *G, *A=NULL, *t=NULL;
++ glp_prob *lp;
++ glp_smcp *options = NULL;
++ pysmcp *smcpParm = NULL;
++ int m, n, p, i, j, k, nnz, nnzmax, *rn=NULL, *cn=NULL;
+ double *a=NULL, val;
+- char param_type, err_str[100];
+-#if PY_MAJOR_VERSION >= 3
+- const char *keystr;
+-#else
+- char *keystr;
+-#endif
+- char *kwlist[] = {"c", "G", "h", "A", "b", NULL};
++ char *kwlist[] = {"c", "G", "h", "A", "b","options", NULL};
+
+- if (!PyArg_ParseTupleAndKeywords(args, kwrds, "OOO|OO", kwlist, &c,
+- &G, &h, &A, &b)) return NULL;
++ if (!PyArg_ParseTupleAndKeywords(args, kwrds, "OOO|OOO!", kwlist, &c,
++ &G, &h, &A, &b,&smcp_t,&smcpParm)) return NULL;
+
+ if ((Matrix_Check(G) && MAT_ID(G) != DOUBLE) ||
+ (SpMatrix_Check(G) && SP_ID(G) != DOUBLE) ||
+@@ -182,19 +373,30 @@
+ PyErr_SetString(PyExc_ValueError, "incompatible dimensions");
+ return NULL;
+ }
++ if(!smcpParm)
++ {
++ smcpParm = (pysmcp*)malloc(sizeof(*smcpParm));
++ glp_init_smcp(&(smcpParm->obj));
++ }
++ if(smcpParm)
++ {
++ Py_INCREF(smcpParm);
++ options = &smcpParm->obj;
++ options->presolve = 1;
++ }
+
+- lp = lpx_create_prob();
+- lpx_add_rows(lp, m+p);
+- lpx_add_cols(lp, n);
++ lp = glp_create_prob();
++ glp_add_rows(lp, m+p);
++ glp_add_cols(lp, n);
+
+ for (i=0; i<n; i++){
+- lpx_set_obj_coef(lp, i+1, MAT_BUFD(c)[i]);
+- lpx_set_col_bnds(lp, i+1, LPX_FR, 0.0, 0.0);
++ glp_set_obj_coef(lp, i+1, MAT_BUFD(c)[i]);
++ glp_set_col_bnds(lp, i+1, GLP_FR, 0.0, 0.0);
+ }
+ for (i=0; i<m; i++)
+- lpx_set_row_bnds(lp, i+1, LPX_UP, 0.0, MAT_BUFD(h)[i]);
++ glp_set_row_bnds(lp, i+1, GLP_UP, 0.0, MAT_BUFD(h)[i]);
+ for (i=0; i<p; i++)
+- lpx_set_row_bnds(lp, i+m+1, LPX_FX, MAT_BUFD(b)[i],
++ glp_set_row_bnds(lp, i+m+1, GLP_FX, MAT_BUFD(b)[i],
+ MAT_BUFD(b)[i]);
+
+ nnzmax = (SpMatrix_Check(G) ? SP_NNZ(G) : m*n ) +
+@@ -203,7 +405,7 @@
+ rn = (int *) calloc(nnzmax+1, sizeof(int));
+ cn = (int *) calloc(nnzmax+1, sizeof(int));
+ if (!a || !rn || !cn){
+- free(a); free(rn); free(cn); lpx_delete_prob(lp);
++ free(a); free(rn); free(cn); glp_delete_prob(lp);
+ return PyErr_NoMemory();
+ }
+
+@@ -242,84 +444,18 @@
+ nnz++;
+ }
+
+- lpx_load_matrix(lp, nnz, rn, cn, a);
++ glp_load_matrix(lp, nnz, rn, cn, a);
+ free(rn); free(cn); free(a);
+
+ if (!(t = PyTuple_New(A ? 4 : 3))){
+- lpx_delete_prob(lp);
++ glp_delete_prob(lp);
+ return PyErr_NoMemory();
+ }
+
+- if (!(param = PyObject_GetAttrString(glpk_module, "options"))
+- || !PyDict_Check(param)){
+- lpx_delete_prob(lp);
+- PyErr_SetString(PyExc_AttributeError,
+- "missing glpk.options dictionary");
+- return NULL;
+- }
+-
+- while (PyDict_Next(param, &pos, &key, &value))
+-#if PY_MAJOR_VERSION >= 3
+- if ((PyUnicode_Check(key)) &&
+- get_param_idx(_PyUnicode_AsString(key), &param_id,
+- &param_type)){
+- keystr = _PyUnicode_AsString(key);
+-#else
+- if ((keystr = PyString_AsString(key)) && get_param_idx(keystr,
+- &param_id, &param_type)){
+-#endif
+- if (param_type == 'i'){
+-#if PY_MAJOR_VERSION >= 3
+- if (!PyLong_Check(value)){
+-#else
+- if (!PyInt_Check(value)){
+-#endif
+- sprintf(err_str, "invalid value for integer "
+- "GLPK parameter: %-.20s", keystr);
+- PyErr_SetString(PyExc_ValueError, err_str);
+- lpx_delete_prob(lp);
+- Py_DECREF(param);
+- return NULL;
+- }
+- if (!strcmp("LPX_K_PRESOL", keystr) &&
+-#if PY_MAJOR_VERSION >= 3
+- PyLong_AS_LONG(value) != 1){
+-#else
+- PyInt_AS_LONG(value) != 1){
+-#endif
+- PyErr_Warn(PyExc_UserWarning, "ignoring value of "
+- "GLPK parameter 'LPX_K_PRESOL'");
+- }
+- else lpx_set_int_parm(lp, param_id,
+-#if PY_MAJOR_VERSION >= 3
+- PyLong_AS_LONG(value));
+-#else
+- PyInt_AS_LONG(value));
+-#endif
+- }
+- else {
+-#if PY_MAJOR_VERSION >= 3
+- if (!PyLong_Check(value) && !PyFloat_Check(value)){
+-#else
+- if (!PyInt_Check(value) && !PyFloat_Check(value)){
+-#endif
+- sprintf(err_str, "invalid value for floating point "
+- "GLPK parameter: %-.20s", keystr);
+- PyErr_SetString(PyExc_ValueError, err_str);
+- lpx_delete_prob(lp);
+- Py_DECREF(param);
+- return NULL;
+- }
+- lpx_set_real_parm(lp, param_id,
+- PyFloat_AsDouble(value));
+- }
+- }
+- lpx_set_int_parm(lp, LPX_K_PRESOL, 1);
+- Py_DECREF(param);
+
+- switch (lpx_simplex(lp)){
++ switch (glp_simplex(lp,options)){
+
+- case LPX_E_OK:
++ case 0:
+
+ x = (matrix *) Matrix_New(n,1,DOUBLE);
+ z = (matrix *) Matrix_New(m,1,DOUBLE);
+@@ -329,65 +465,70 @@
+ Py_XDECREF(z);
+ Py_XDECREF(y);
+ Py_XDECREF(t);
+- lpx_delete_prob(lp);
++ Py_XDECREF(smcpParm);
++ glp_delete_prob(lp);
+ return PyErr_NoMemory();
+ }
+
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("optimal"));
+-#else
+- PyString_FromString("optimal"));
+-#endif
++ set_output_string(t,"optimal");
+
+ for (i=0; i<n; i++)
+- MAT_BUFD(x)[i] = lpx_get_col_prim(lp, i+1);
++ MAT_BUFD(x)[i] = glp_get_col_prim(lp, i+1);
+ PyTuple_SET_ITEM(t, 1, (PyObject *) x);
+
+ for (i=0; i<m; i++)
+- MAT_BUFD(z)[i] = -lpx_get_row_dual(lp, i+1);
++ MAT_BUFD(z)[i] = -glp_get_row_dual(lp, i+1);
+ PyTuple_SET_ITEM(t, 2, (PyObject *) z);
+
+ if (A){
+ for (i=0; i<p; i++)
+- MAT_BUFD(y)[i] = -lpx_get_row_dual(lp, m+i+1);
++ MAT_BUFD(y)[i] = -glp_get_row_dual(lp, m+i+1);
+ PyTuple_SET_ITEM(t, 3, (PyObject *) y);
+ }
+
+- lpx_delete_prob(lp);
++ Py_XDECREF(smcpParm);
++ glp_delete_prob(lp);
+ return (PyObject *) t;
+-
+- case LPX_E_NOPFS:
+-
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("primal infeasible"));
+-#else
+- PyString_FromString("primal infeasible"));
+-#endif
++ case GLP_EBADB:
++ set_output_string(t,"incorrect initial basis");
+ break;
+-
+- case LPX_E_NODFS:
+-
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("dual infeasible"));
+-#else
+- PyString_FromString("dual infeasible"));
+-#endif
++ case GLP_ESING:
++ set_output_string(t,"singular initial basis matrix");
++ break;
++ case GLP_ECOND:
++ set_output_string(t,"ill-conditioned initial basis matrix");
++ break;
++ case GLP_EBOUND:
++ set_output_string(t,"incorrect bounds");
++ break;
++ case GLP_EFAIL:
++ set_output_string(t,"solver failure");
++ break;
++ case GLP_EOBJLL:
++ set_output_string(t,"objective function reached lower limit");
++ break;
++ case GLP_EOBJUL:
++ set_output_string(t,"objective function reached upper limit");
++ break;
++ case GLP_EITLIM:
++ set_output_string(t,"iteration limit exceeded");
++ break;
++ case GLP_ETMLIM:
++ set_output_string(t,"time limit exceeded");
++ break;
++ case GLP_ENOPFS:
++ set_output_string(t,"primal infeasible");
++ break;
++ case GLP_ENODFS:
++ set_output_string(t,"dual infeasible");
+ break;
+-
+ default:
+-
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("unknown"));
+-#else
+- PyString_FromString("unknown"));
+-#endif
++ set_output_string(t,"unknown");
++ break;
+ }
+
+- lpx_delete_prob(lp);
++ Py_XDECREF(smcpParm);
++ glp_delete_prob(lp);
+
+ PyTuple_SET_ITEM(t, 1, Py_BuildValue(""));
+ PyTuple_SET_ITEM(t, 2, Py_BuildValue(""));
+@@ -427,21 +568,28 @@
+ {
+ matrix *c, *h, *b=NULL, *x=NULL;
+ PyObject *G, *A=NULL, *IntSet=NULL, *BinSet = NULL;
+- PyObject *t=NULL, *param, *key, *value;
+- LPX *lp;
+- int m, n, p, i, j, k, nnz, nnzmax, *rn=NULL, *cn=NULL, param_id;
+- int_t pos=0;
++ PyObject *t=NULL;
++ pyiocp *iocpParm = NULL;;
++ glp_iocp *options = NULL;
++ glp_prob *lp;
++ int m, n, p, i, j, k, nnz, nnzmax, *rn=NULL, *cn=NULL;
+ double *a=NULL, val;
+- char param_type, err_str[100];
+-#if PY_MAJOR_VERSION >= 3
+- const char *keystr;
+-#else
+- char *keystr;
+-#endif
+- char *kwlist[] = {"c", "G", "h", "A", "b", "I", "B", NULL};
++ char *kwlist[] = {"c", "G", "h", "A", "b", "I", "B","iocp", NULL};
++
++ if (!PyArg_ParseTupleAndKeywords(args, kwrds, "OOO|OOOOO!", kwlist, &c,
++ &G, &h, &A, &b, &IntSet, &BinSet,iocp_t,&iocpParm)) return NULL;
+
+- if (!PyArg_ParseTupleAndKeywords(args, kwrds, "OOO|OOOO", kwlist, &c,
+- &G, &h, &A, &b, &IntSet, &BinSet)) return NULL;
++ if(!iocpParm)
++ {
++ iocpParm = (pyiocp*)malloc(sizeof(*iocpParm));
++ glp_init_iocp(&(iocpParm->obj));
++ }
++ if(iocpParm)
++ {
++ Py_INCREF(iocpParm);
++ options = &iocpParm->obj;
++ options->presolve = 1;
++ }
+
+ if ((Matrix_Check(G) && MAT_ID(G) != DOUBLE) ||
+ (SpMatrix_Check(G) && SP_ID(G) != DOUBLE) ||
+@@ -490,18 +638,18 @@
+ if ((BinSet) && (!PyAnySet_Check(BinSet)))
+ PY_ERR_TYPE("invalid binary index set");
+
+- lp = lpx_create_prob();
+- lpx_add_rows(lp, m+p);
+- lpx_add_cols(lp, n);
++ lp = glp_create_prob();
++ glp_add_rows(lp, m+p);
++ glp_add_cols(lp, n);
+
+ for (i=0; i<n; i++){
+- lpx_set_obj_coef(lp, i+1, MAT_BUFD(c)[i]);
+- lpx_set_col_bnds(lp, i+1, LPX_FR, 0.0, 0.0);
++ glp_set_obj_coef(lp, i+1, MAT_BUFD(c)[i]);
++ glp_set_col_bnds(lp, i+1, GLP_FR, 0.0, 0.0);
+ }
+ for (i=0; i<m; i++)
+- lpx_set_row_bnds(lp, i+1, LPX_UP, 0.0, MAT_BUFD(h)[i]);
++ glp_set_row_bnds(lp, i+1, GLP_UP, 0.0, MAT_BUFD(h)[i]);
+ for (i=0; i<p; i++)
+- lpx_set_row_bnds(lp, i+m+1, LPX_FX, MAT_BUFD(b)[i],
++ glp_set_row_bnds(lp, i+m+1, GLP_FX, MAT_BUFD(b)[i],
+ MAT_BUFD(b)[i]);
+
+ nnzmax = (SpMatrix_Check(G) ? SP_NNZ(G) : m*n ) +
+@@ -510,7 +658,7 @@
+ rn = (int *) calloc(nnzmax+1, sizeof(int));
+ cn = (int *) calloc(nnzmax+1, sizeof(int));
+ if (!a || !rn || !cn){
+- free(a); free(rn); free(cn); lpx_delete_prob(lp);
++ free(a); free(rn); free(cn); glp_delete_prob(lp);
+ return PyErr_NoMemory();
+ }
+
+@@ -549,79 +697,14 @@
+ nnz++;
+ }
+
+- lpx_load_matrix(lp, nnz, rn, cn, a);
++ glp_load_matrix(lp, nnz, rn, cn, a);
+ free(rn); free(cn); free(a);
+
+ if (!(t = PyTuple_New(2))) {
+- lpx_delete_prob(lp);
++ glp_delete_prob(lp);
+ return PyErr_NoMemory();
+ }
+
+- if (!(param = PyObject_GetAttrString(glpk_module, "options"))
+- || !PyDict_Check(param)){
+- lpx_delete_prob(lp);
+- PyErr_SetString(PyExc_AttributeError,
+- "missing glpk.options dictionary");
+- return NULL;
+- }
+-
+- while (PyDict_Next(param, &pos, &key, &value))
+-#if PY_MAJOR_VERSION >= 3
+- if ((PyUnicode_Check(key)) && (keystr = PyUnicode_AS_DATA(key))
+- && get_param_idx(keystr, &param_id, &param_type)){
+-#else
+- if ((keystr = PyString_AsString(key)) && get_param_idx(keystr,
+- &param_id, &param_type)){
+-#endif
+- if (param_type == 'i'){
+-#if PY_MAJOR_VERSION >= 3
+- if (!PyLong_Check(value)){
+-#else
+- if (!PyInt_Check(value)){
+-#endif
+- sprintf(err_str, "invalid value for integer "
+- "GLPK parameter: %-.20s", keystr);
+- PyErr_SetString(PyExc_ValueError, err_str);
+- lpx_delete_prob(lp);
+- Py_DECREF(param);
+- return NULL;
+- }
+- if (!strcmp("LPX_K_PRESOL", keystr) &&
+-#if PY_MAJOR_VERSION >= 3
+- PyLong_AS_LONG(value) != 1){
+-#else
+- PyInt_AS_LONG(value) != 1){
+-#endif
+- PyErr_Warn(PyExc_UserWarning, "ignoring value of "
+- "GLPK parameter 'LPX_K_PRESOL'");
+- }
+- else
+-#if PY_MAJOR_VERSION >= 3
+- lpx_set_int_parm(lp, param_id, PyLong_AS_LONG(value));
+-#else
+- lpx_set_int_parm(lp, param_id, PyInt_AS_LONG(value));
+-#endif
+- }
+- else {
+-#if PY_MAJOR_VERSION >= 3
+- if (!PyLong_Check(value) && !PyFloat_Check(value)){
+-#else
+- if (!PyInt_Check(value) && !PyFloat_Check(value)){
+-#endif
+- sprintf(err_str, "invalid value for floating point "
+- "GLPK parameter: %-.20s", keystr);
+- PyErr_SetString(PyExc_ValueError, err_str);
+- lpx_delete_prob(lp);
+- Py_DECREF(param);
+- return NULL;
+- }
+- lpx_set_real_parm(lp, param_id,
+- PyFloat_AsDouble(value));
+- }
+- }
+- lpx_set_int_parm(lp, LPX_K_PRESOL, 1);
+- Py_DECREF(param);
+-
+ if (IntSet) {
+ PyObject *iter = PySequence_Fast(IntSet, "Critical error: not sequence");
+
+@@ -633,7 +716,7 @@
+ #else
+ if (!PyInt_Check(tmp)) {
+ #endif
+- lpx_delete_prob(lp);
++ glp_delete_prob(lp);
+ Py_DECREF(iter);
+ PY_ERR_TYPE("non-integer element in I");
+ }
+@@ -643,7 +726,7 @@
+ int k = PyInt_AS_LONG(tmp);
+ #endif
+ if ((k < 0) || (k >= n)) {
+- lpx_delete_prob(lp);
++ glp_delete_prob(lp);
+ Py_DECREF(iter);
+ PY_ERR(PyExc_IndexError, "index element out of range in I");
+ }
+@@ -664,7 +747,7 @@
+ #else
+ if (!PyInt_Check(tmp)) {
+ #endif
+- lpx_delete_prob(lp);
++ glp_delete_prob(lp);
+ Py_DECREF(iter);
+ PY_ERR_TYPE("non-binary element in I");
+ }
+@@ -674,7 +757,7 @@
+ int k = PyInt_AS_LONG(tmp);
+ #endif
+ if ((k < 0) || (k >= n)) {
+- lpx_delete_prob(lp);
++ glp_delete_prob(lp);
+ Py_DECREF(iter);
+ PY_ERR(PyExc_IndexError, "index element out of range in B");
+ }
+@@ -686,114 +769,85 @@
+ }
+
+
++ switch (glp_intopt(lp,options)){
+
+- switch (lpx_intopt(lp)){
++ case 0:
+
+- case LPX_E_OK:
++ x = (matrix *) Matrix_New(n,1,DOUBLE);
++ if (!x) {
++ Py_XDECREF(iocpParm);
++ Py_XDECREF(t);
++ glp_delete_prob(lp);
++ return PyErr_NoMemory();
++ }
++ set_output_string(t,"optimal");
++ set_output_string(t,"optimal");
+
+- x = (matrix *) Matrix_New(n,1,DOUBLE);
+- if (!x) {
+- Py_XDECREF(t);
+- lpx_delete_prob(lp);
+- return PyErr_NoMemory();
+- }
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("optimal"));
+-#else
+- PyString_FromString("optimal"));
+-#endif
++ for (i=0; i<n; i++)
++ MAT_BUFD(x)[i] = glp_mip_col_val(lp, i+1);
++ PyTuple_SET_ITEM(t, 1, (PyObject *) x);
+
+- for (i=0; i<n; i++)
+- MAT_BUFD(x)[i] = lpx_mip_col_val(lp, i+1);
+- PyTuple_SET_ITEM(t, 1, (PyObject *) x);
++ Py_XDECREF(iocpParm);
++ glp_delete_prob(lp);
++ return (PyObject *) t;
+
+- lpx_delete_prob(lp);
+- return (PyObject *) t;
++ case GLP_ETMLIM:
+
+- case LPX_E_TMLIM:
++ x = (matrix *) Matrix_New(n,1,DOUBLE);
++ if (!x) {
++ Py_XDECREF(t);
++ Py_XDECREF(iocpParm);
++ glp_delete_prob(lp);
++ return PyErr_NoMemory();
++ }
++ set_output_string(t,"time limit exceeded");
+
+- x = (matrix *) Matrix_New(n,1,DOUBLE);
+- if (!x) {
+- Py_XDECREF(t);
+- lpx_delete_prob(lp);
+- return PyErr_NoMemory();
+- }
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("time limit exceeded"));
+-#else
+- PyString_FromString("time limit exceeded"));
+-#endif
++ for (i=0; i<n; i++)
++ MAT_BUFD(x)[i] = glp_mip_col_val(lp, i+1);
++ PyTuple_SET_ITEM(t, 1, (PyObject *) x);
+
+- for (i=0; i<n; i++)
+- MAT_BUFD(x)[i] = lpx_mip_col_val(lp, i+1);
+- PyTuple_SET_ITEM(t, 1, (PyObject *) x);
+-
+- lpx_delete_prob(lp);
+- return (PyObject *) t;
++ Py_XDECREF(iocpParm);
++ glp_delete_prob(lp);
++ return (PyObject *) t;
+
+
+- case LPX_E_FAULT:
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("invalid MIP formulation"));
+-#else
+- PyString_FromString("invalid MIP formulation"));
+-#endif
+- break;
++ case GLP_EBOUND:
++ set_output_string(t,"incorrect bounds");
++ break;
++ case GLP_EFAIL:
++ set_output_string(t,"invalid MIP formulation");
++ break;
+
+- case LPX_E_NOPFS:
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("primal infeasible"));
+-#else
+- PyString_FromString("primal infeasible"));
+-#endif
+- break;
++ case GLP_ENOPFS:
++ set_output_string(t,"primal infeasible");
++ break;
+
+- case LPX_E_NODFS:
++ case GLP_ENODFS:
++ set_output_string(t,"dual infeasible");
++ break;
+
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("dual infeasible"));
+-#else
+- PyString_FromString("dual infeasible"));
+-#endif
+- break;
++ case GLP_EMIPGAP:
++ set_output_string(t,"Relative mip gap tolerance reached");
++ break;
+
+- case LPX_E_ITLIM:
++ /*case LPX_E_ITLIM:
+
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("maxiters exceeded"));
+-#else
+- PyString_FromString("maxiters exceeded"));
+-#endif
+- break;
++ set_output_string(t,"maxiters exceeded");
++ break;*/
+
+- case LPX_E_SING:
++ /*case LPX_E_SING:
+
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("singular or ill-conditioned basis"));
+-#else
+- PyString_FromString("singular or ill-conditioned basis"));
+-#endif
+- break;
++ set_output_string(t,"singular or ill-conditioned basis");
++ break;*/
+
+
+- default:
++ default:
+
+- PyTuple_SET_ITEM(t, 0, (PyObject *)
+-#if PY_MAJOR_VERSION >= 3
+- PyUnicode_FromString("unknown"));
+-#else
+- PyString_FromString("unknown"));
+-#endif
+- }
++ set_output_string(t,"unknown");
++ }
+
+- lpx_delete_prob(lp);
++ Py_XDECREF(iocpParm);
++ glp_delete_prob(lp);
+
+ PyTuple_SET_ITEM(t, 1, Py_BuildValue(""));
+ return (PyObject *) t;
+@@ -819,10 +873,94 @@
+ NULL, NULL, NULL, NULL
+ };
+
++void addglpkConstants (void)
++{
++ PyModule_AddIntMacro(glpk_module, GLP_ON);
++ PyModule_AddIntMacro(glpk_module,GLP_OFF);
++
++ /* reason codes: */
++ PyModule_AddIntMacro(glpk_module,GLP_IROWGEN);
++ PyModule_AddIntMacro(glpk_module,GLP_IBINGO);
++ PyModule_AddIntMacro(glpk_module,GLP_IHEUR);
++ PyModule_AddIntMacro(glpk_module,GLP_ICUTGEN);
++ PyModule_AddIntMacro(glpk_module,GLP_IBRANCH);
++ PyModule_AddIntMacro(glpk_module,GLP_ISELECT);
++ PyModule_AddIntMacro(glpk_module,GLP_IPREPRO);
++
++ /* branch selection indicator: */
++ PyModule_AddIntMacro(glpk_module,GLP_NO_BRNCH);
++ PyModule_AddIntMacro(glpk_module,GLP_DN_BRNCH);
++ PyModule_AddIntMacro(glpk_module,GLP_UP_BRNCH);
++
++ /* return codes: */
++ PyModule_AddIntMacro(glpk_module,GLP_EBADB);
++ PyModule_AddIntMacro(glpk_module,GLP_ESING);
++ PyModule_AddIntMacro(glpk_module,GLP_ECOND);
++ PyModule_AddIntMacro(glpk_module,GLP_EBOUND);
++ PyModule_AddIntMacro(glpk_module,GLP_EFAIL);
++ PyModule_AddIntMacro(glpk_module,GLP_EOBJLL);
++ PyModule_AddIntMacro(glpk_module,GLP_EOBJUL);
++ PyModule_AddIntMacro(glpk_module,GLP_EITLIM);
++ PyModule_AddIntMacro(glpk_module,GLP_ETMLIM);
++ PyModule_AddIntMacro(glpk_module,GLP_ENOPFS);
++ PyModule_AddIntMacro(glpk_module,GLP_ENODFS);
++ PyModule_AddIntMacro(glpk_module,GLP_EROOT);
++ PyModule_AddIntMacro(glpk_module,GLP_ESTOP);
++ PyModule_AddIntMacro(glpk_module,GLP_EMIPGAP);
++ PyModule_AddIntMacro(glpk_module,GLP_ENOFEAS);
++ PyModule_AddIntMacro(glpk_module,GLP_ENOCVG);
++ PyModule_AddIntMacro(glpk_module,GLP_EINSTAB);
++ PyModule_AddIntMacro(glpk_module,GLP_EDATA);
++ PyModule_AddIntMacro(glpk_module,GLP_ERANGE);
++
++ /* condition indicator: */
++ PyModule_AddIntMacro(glpk_module,GLP_KKT_PE);
++ PyModule_AddIntMacro(glpk_module,GLP_KKT_PB);
++ PyModule_AddIntMacro(glpk_module,GLP_KKT_DE);
++ PyModule_AddIntMacro(glpk_module,GLP_KKT_DB);
++ PyModule_AddIntMacro(glpk_module,GLP_KKT_CS);
++
++ /* MPS file format: */
++ PyModule_AddIntMacro(glpk_module,GLP_MPS_DECK);
++ PyModule_AddIntMacro(glpk_module,GLP_MPS_FILE);
++
++ /* simplex method control parameters */
++ /* message level: */
++ PyModule_AddIntMacro(glpk_module,GLP_MSG_OFF);
++ PyModule_AddIntMacro(glpk_module,GLP_MSG_ERR);
++ PyModule_AddIntMacro(glpk_module,GLP_MSG_ON);
++ PyModule_AddIntMacro(glpk_module,GLP_MSG_ALL);
++ PyModule_AddIntMacro(glpk_module,GLP_MSG_DBG);
++ /* simplex method option: */
++ PyModule_AddIntMacro(glpk_module,GLP_PRIMAL);
++ PyModule_AddIntMacro(glpk_module,GLP_DUALP);
++ PyModule_AddIntMacro(glpk_module,GLP_DUAL);
++ /* pricing technique: */
++ PyModule_AddIntMacro(glpk_module,GLP_PT_STD);
++ PyModule_AddIntMacro(glpk_module,GLP_PT_PSE);
++ /* ratio test technique: */
++ PyModule_AddIntMacro(glpk_module,GLP_RT_STD);
++ PyModule_AddIntMacro(glpk_module,GLP_RT_HAR);
++
++ /* interior-point solver control parameters */
++ /* ordering algorithm: */
++ PyModule_AddIntMacro(glpk_module,GLP_ORD_NONE);
++ PyModule_AddIntMacro(glpk_module,GLP_ORD_QMD);
++ PyModule_AddIntMacro(glpk_module,GLP_ORD_AMD);
++ PyModule_AddIntMacro(glpk_module,GLP_ORD_SYMAMD);
++}
++
+ PyMODINIT_FUNC PyInit_glpk(void)
+ {
+ if (!(glpk_module = PyModule_Create(&glpk_module_def))) return NULL;
+- PyModule_AddObject(glpk_module, "options", PyDict_New());
++ if (PyType_Ready(&iocp_t) < 0 || (PyType_Ready(&smcp_t) < 0)) return NULL;
++ /* Adding macros */
++ addglpkConstants();
++ /* Adding option lists as objects */
++ Py_INCREF(&smcp_t);
++ PyModule_AddObject(glpk_module,"smcp",(PyObject*)&smcp_t);
++ Py_INCREF(&iocp_t);
++ PyModule_AddObject(glpk_module,"iocp",(PyObject*)&iocp_t);
+ if (import_cvxopt() < 0) return NULL;
+ return glpk_module;
+ }
+@@ -832,8 +970,13 @@
+ PyMODINIT_FUNC initglpk(void)
+ {
+ glpk_module = Py_InitModule3("cvxopt.glpk", glpk_functions,
+- glpk__doc__);
+- PyModule_AddObject(glpk_module, "options", PyDict_New());
++ glpk__doc__);
++ if (PyType_Ready(&iocp_t) < 0 || (PyType_Ready(&smcp_t) < 0)) return NULL;
++ addglpkConstants();
++ Py_INCREF(&smcp_t);
++ PyModule_AddObject(glpk_module,"smcp",(PyObject*)&smcp_t);
++ Py_INCREF(&iocp_t);
++ PyModule_AddObject(glpk_module,"iocp",(PyObject*)&iocp_t);
+ if (import_cvxopt() < 0) return;
+ }
+
diff --git a/dev-python/cvxopt/files/cvxopt-1.1.6-setup.patch b/dev-python/cvxopt/files/cvxopt-1.1.6-setup.patch
new file mode 100644
index 000000000000..c95f31bf6048
--- /dev/null
+++ b/dev-python/cvxopt/files/cvxopt-1.1.6-setup.patch
@@ -0,0 +1,176 @@
+--- setup.py.orig 2013-05-16 21:36:29.616510963 +1200
++++ setup.py 2013-05-16 21:51:08.456347311 +1200
+@@ -2,7 +2,7 @@
+ from glob import glob
+
+ # Modifiy this if BLAS and LAPACK libraries are not in /usr/lib.
+-BLAS_LIB_DIR = '/usr/lib'
++BLAS_LIB_DIR = ''
+
+ # Default names of BLAS and LAPACK libraries
+ BLAS_LIB = ['blas']
+@@ -18,37 +18,37 @@
+ BUILD_GSL = 0
+
+ # Directory containing libgsl (used only when BUILD_GSL = 1).
+-GSL_LIB_DIR = '/usr/lib'
++GSL_LIB_DIR = ''
+
+ # Directory containing the GSL header files (used only when BUILD_GSL = 1).
+-GSL_INC_DIR = '/usr/include/gsl'
++GSL_INC_DIR = ''
+
+ # Set to 1 if you are installing the fftw module.
+ BUILD_FFTW = 0
+
+ # Directory containing libfftw3 (used only when BUILD_FFTW = 1).
+-FFTW_LIB_DIR = '/usr/lib'
++FFTW_LIB_DIR = ''
+
+ # Directory containing fftw.h (used only when BUILD_FFTW = 1).
+-FFTW_INC_DIR = '/usr/include'
++FFTW_INC_DIR = ''
+
+ # Set to 1 if you are installing the glpk module.
+ BUILD_GLPK = 0
+
+ # Directory containing libglpk (used only when BUILD_GLPK = 1).
+-GLPK_LIB_DIR = '/usr/lib'
++GLPK_LIB_DIR = ''
+
+ # Directory containing glpk.h (used only when BUILD_GLPK = 1).
+-GLPK_INC_DIR = '/usr/include'
++GLPK_INC_DIR = ''
+
+ # Set to 1 if you are installing the DSDP module.
+ BUILD_DSDP = 0
+
+ # Directory containing libdsdp (used only when BUILD_DSDP = 1).
+-DSDP_LIB_DIR = '/usr/lib'
++DSDP_LIB_DIR = ''
+
+ # Directory containing dsdp5.h (used only when BUILD_DSDP = 1).
+-DSDP_INC_DIR = '/usr/include/dsdp'
++DSDP_INC_DIR = ''
+
+ # No modifications should be needed below this line.
+
+@@ -61,39 +61,32 @@
+ # optional modules
+
+ if BUILD_GSL:
+- gsl = Extension('gsl', libraries = ['m', 'gsl'] + BLAS_LIB,
+- include_dirs = [ GSL_INC_DIR ],
+- library_dirs = [ GSL_LIB_DIR, BLAS_LIB_DIR ],
+- extra_link_args = BLAS_EXTRA_LINK_ARGS,
++ gsl = Extension('gsl', libraries = ['gsl'],
++ library_dirs = [ GSL_LIB_DIR ],
+ sources = ['src/C/gsl.c'] )
+ extmods += [gsl];
+
+ if BUILD_FFTW:
+- fftw = Extension('fftw', libraries = ['fftw3'] + BLAS_LIB,
+- include_dirs = [ FFTW_INC_DIR ],
+- library_dirs = [ FFTW_LIB_DIR, BLAS_LIB_DIR ],
+- extra_link_args = BLAS_EXTRA_LINK_ARGS,
++ fftw = Extension('fftw', libraries = ['fftw3'],
++ library_dirs = [ FFTW_LIB_DIR ],
+ sources = ['src/C/fftw.c'] )
+ extmods += [fftw];
+
+ if BUILD_GLPK:
+ glpk = Extension('glpk', libraries = ['glpk'],
+- include_dirs = [ GLPK_INC_DIR ],
+ library_dirs = [ GLPK_LIB_DIR ],
+ sources = ['src/C/glpk.c'] )
+ extmods += [glpk];
+
+ if BUILD_DSDP:
+- dsdp = Extension('dsdp', libraries = ['dsdp'] + LAPACK_LIB + BLAS_LIB,
+- include_dirs = [ DSDP_INC_DIR ],
+- library_dirs = [ DSDP_LIB_DIR, BLAS_LIB_DIR ],
+- extra_link_args = BLAS_EXTRA_LINK_ARGS,
++ dsdp = Extension('dsdp', libraries = ['dsdp'],
++ library_dirs = [ DSDP_LIB_DIR ],
+ sources = ['src/C/dsdp.c'] )
+ extmods += [dsdp];
+
+ # Required modules
+
+-base = Extension('base', libraries = ['m'] + LAPACK_LIB + BLAS_LIB,
++base = Extension('base', libraries = ['m'] + LAPACK_LIB,
+ library_dirs = [ BLAS_LIB_DIR ],
+ define_macros = MACROS,
+ extra_link_args = BLAS_EXTRA_LINK_ARGS,
+@@ -105,61 +98,36 @@
+ extra_link_args = BLAS_EXTRA_LINK_ARGS,
+ sources = ['src/C/blas.c'] )
+
+-lapack = Extension('lapack', libraries = LAPACK_LIB + BLAS_LIB,
++lapack = Extension('lapack', libraries = LAPACK_LIB,
+ library_dirs = [ BLAS_LIB_DIR ],
+ define_macros = MACROS,
+ extra_link_args = BLAS_EXTRA_LINK_ARGS,
+ sources = ['src/C/lapack.c'] )
+
+ umfpack = Extension('umfpack',
+- include_dirs = [ 'src/C/SuiteSparse/UMFPACK/Include',
+- 'src/C/SuiteSparse/AMD/Include',
+- 'src/C/SuiteSparse/AMD/Source',
+- 'src/C/SuiteSparse/SuiteSparse_config' ],
+ library_dirs = [ BLAS_LIB_DIR ],
+ define_macros = MACROS + [('NTIMER', '1'), ('NCHOLMOD', '1')],
+- libraries = LAPACK_LIB + BLAS_LIB,
++ libraries = [ 'umfpack' ],
+ extra_compile_args = ['-Wno-unknown-pragmas'],
+- extra_link_args = BLAS_EXTRA_LINK_ARGS,
+- sources = [ 'src/C/umfpack.c',
+- 'src/C/SuiteSparse/UMFPACK/Source/umfpack_global.c',
+- 'src/C/SuiteSparse/UMFPACK/Source/umfpack_tictoc.c' ] +
+- ['src/C/SuiteSparse/SuiteSparse_config/SuiteSparse_config.c'] +
+- glob('src/C/SuiteSparse_cvxopt_extra/umfpack/*'))
++ sources = [ 'src/C/umfpack.c' ])
+
+ # Build for int or long?
+ import sys
+ if sys.maxsize > 2**31: MACROS += [('DLONG',None)]
+
+ cholmod = Extension('cholmod',
+- library_dirs = [ BLAS_LIB_DIR ],
+- libraries = LAPACK_LIB + BLAS_LIB,
+- include_dirs = [ 'src/C/SuiteSparse/CHOLMOD/Include',
+- 'src/C/SuiteSparse/COLAMD',
+- 'src/C/SuiteSparse/AMD/Include',
+- 'src/C/SuiteSparse/COLAMD/Include',
+- 'src/C/SuiteSparse/SuiteSparse_config' ],
+- define_macros = MACROS + [('NPARTITION', '1'), ('NTIMER', '1')],
+- extra_link_args = BLAS_EXTRA_LINK_ARGS,
+- sources = [ 'src/C/cholmod.c' ] +
+- ['src/C/SuiteSparse/AMD/Source/' + s for s in ['amd_global.c',
+- 'amd_postorder.c', 'amd_post_tree.c', 'amd_2.c']] +
+- ['src/C/SuiteSparse/COLAMD/Source/' + s for s in ['colamd.c',
+- 'colamd_global.c']] +
+- ['src/C/SuiteSparse/SuiteSparse_config/SuiteSparse_config.c'] +
+- glob('src/C/SuiteSparse/CHOLMOD/Core/c*.c') +
+- glob('src/C/SuiteSparse/CHOLMOD/Cholesky/c*.c') +
+- ['src/C/SuiteSparse/CHOLMOD/Check/cholmod_check.c'] +
+- glob('src/C/SuiteSparse/CHOLMOD/Supernodal/c*.c') )
++ library_dirs = [ BLAS_LIB_DIR ],
++ libraries = ['cholmod'] + BLAS_LIB,
++ define_macros = MACROS + [('NPARTITION', '1'), ('NTIMER', '1')],
++ sources = [ 'src/C/cholmod.c' ])
+
+ amd = Extension('amd',
+- include_dirs = [ 'src/C/SuiteSparse/AMD/Include',
+- 'src/C/SuiteSparse/SuiteSparse_config' ],
+ define_macros = MACROS,
+- sources = [ 'src/C/amd.c' ] + glob('src/C/SuiteSparse/AMD/Source/*.c') )
++ libraries = ['amd'],
++ sources = [ 'src/C/amd.c' ])
+
+ misc_solvers = Extension('misc_solvers',
+- libraries = LAPACK_LIB + BLAS_LIB,
++ libraries = LAPACK_LIB,
+ library_dirs = [ BLAS_LIB_DIR ],
+ define_macros = MACROS,
+ extra_link_args = BLAS_EXTRA_LINK_ARGS,
diff --git a/dev-python/cvxopt/files/cvxopt-1.1.8-setup.patch b/dev-python/cvxopt/files/cvxopt-1.1.8-setup.patch
new file mode 100644
index 000000000000..1b53f7535117
--- /dev/null
+++ b/dev-python/cvxopt/files/cvxopt-1.1.8-setup.patch
@@ -0,0 +1,136 @@
+ setup.py | 45 +++++++++++++++++++--------------------------
+ 1 file changed, 19 insertions(+), 26 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 031ad53..e5c56af 100644
+--- a/setup.py
++++ b/setup.py
+@@ -6,7 +6,7 @@ from glob import glob
+ import os
+
+ # Modifiy this if BLAS and LAPACK libraries are not in /usr/lib.
+-BLAS_LIB_DIR = '/usr/lib'
++BLAS_LIB_DIR = ''
+
+ # Default names of BLAS and LAPACK libraries
+ BLAS_LIB = ['blas']
+@@ -22,37 +22,37 @@ BLAS_NOUNDERSCORES = False
+ BUILD_GSL = 0
+
+ # Directory containing libgsl (used only when BUILD_GSL = 1).
+-GSL_LIB_DIR = '/usr/lib'
++GSL_LIB_DIR = ''
+
+ # Directory containing the GSL header files (used only when BUILD_GSL = 1).
+-GSL_INC_DIR = '/usr/include/gsl'
++GSL_INC_DIR = ''
+
+ # Set to 1 if you are installing the fftw module.
+ BUILD_FFTW = 0
+
+ # Directory containing libfftw3 (used only when BUILD_FFTW = 1).
+-FFTW_LIB_DIR = '/usr/lib'
++FFTW_LIB_DIR = ''
+
+ # Directory containing fftw.h (used only when BUILD_FFTW = 1).
+-FFTW_INC_DIR = '/usr/include'
++FFTW_INC_DIR = ''
+
+ # Set to 1 if you are installing the glpk module.
+ BUILD_GLPK = 0
+
+ # Directory containing libglpk (used only when BUILD_GLPK = 1).
+-GLPK_LIB_DIR = '/usr/lib'
++GLPK_LIB_DIR = ''
+
+ # Directory containing glpk.h (used only when BUILD_GLPK = 1).
+-GLPK_INC_DIR = '/usr/include'
++GLPK_INC_DIR = ''
+
+ # Set to 1 if you are installing the DSDP module.
+ BUILD_DSDP = 0
+
+ # Directory containing libdsdp (used only when BUILD_DSDP = 1).
+-DSDP_LIB_DIR = '/usr/lib'
++DSDP_LIB_DIR = ''
+
+ # Directory containing dsdp5.h (used only when BUILD_DSDP = 1).
+-DSDP_INC_DIR = '/usr/include/dsdp'
++DSDP_INC_DIR = ''
+
+ # Set to 1 to use external SuiteSparse library
+ SUITESPARSE_EXT_LIB = 0
+@@ -98,39 +98,32 @@ if BLAS_NOUNDERSCORES: MACROS.append(('BLAS_NO_UNDERSCORE',''))
+ # optional modules
+
+ if BUILD_GSL:
+- gsl = Extension('gsl', libraries = ['m', 'gsl'] + BLAS_LIB,
+- include_dirs = [ GSL_INC_DIR ],
+- library_dirs = [ GSL_LIB_DIR, BLAS_LIB_DIR ],
+- extra_link_args = BLAS_EXTRA_LINK_ARGS,
++ gsl = Extension('gsl', libraries = ['gsl'],
++ library_dirs = [ GSL_LIB_DIR ],
+ sources = ['src/C/gsl.c'] )
+ extmods += [gsl];
+
+ if BUILD_FFTW:
+- fftw = Extension('fftw', libraries = ['fftw3'] + BLAS_LIB,
+- include_dirs = [ FFTW_INC_DIR ],
+- library_dirs = [ FFTW_LIB_DIR, BLAS_LIB_DIR ],
+- extra_link_args = BLAS_EXTRA_LINK_ARGS,
++ fftw = Extension('fftw', libraries = ['fftw3'],
++ library_dirs = [ FFTW_LIB_DIR ],
+ sources = ['src/C/fftw.c'] )
+ extmods += [fftw];
+
+ if BUILD_GLPK:
+ glpk = Extension('glpk', libraries = ['glpk'],
+- include_dirs = [ GLPK_INC_DIR ],
+ library_dirs = [ GLPK_LIB_DIR ],
+ sources = ['src/C/glpk.c'] )
+ extmods += [glpk];
+
+ if BUILD_DSDP:
+- dsdp = Extension('dsdp', libraries = ['dsdp'] + LAPACK_LIB + BLAS_LIB,
+- include_dirs = [ DSDP_INC_DIR ],
+- library_dirs = [ DSDP_LIB_DIR, BLAS_LIB_DIR ],
+- extra_link_args = BLAS_EXTRA_LINK_ARGS,
++ dsdp = Extension('dsdp', libraries = ['dsdp'] + LAPACK_LIB,
++ library_dirs = [ DSDP_LIB_DIR ],
+ sources = ['src/C/dsdp.c'] )
+ extmods += [dsdp];
+
+ # Required modules
+
+-base = Extension('base', libraries = ['m'] + LAPACK_LIB + BLAS_LIB,
++base = Extension('base', libraries = ['m'] + LAPACK_LIB,
+ library_dirs = [ BLAS_LIB_DIR ],
+ define_macros = MACROS,
+ extra_link_args = BLAS_EXTRA_LINK_ARGS,
+@@ -142,7 +135,7 @@ blas = Extension('blas', libraries = BLAS_LIB,
+ extra_link_args = BLAS_EXTRA_LINK_ARGS,
+ sources = ['src/C/blas.c'] )
+
+-lapack = Extension('lapack', libraries = LAPACK_LIB + BLAS_LIB,
++lapack = Extension('lapack', libraries = LAPACK_LIB,
+ library_dirs = [ BLAS_LIB_DIR ],
+ define_macros = MACROS,
+ extra_link_args = BLAS_EXTRA_LINK_ARGS,
+@@ -177,7 +170,7 @@ if sys.maxsize > 2**31: MACROS += [('DLONG',None)]
+
+ if SUITESPARSE_EXT_LIB:
+ cholmod = Extension('cholmod',
+- libraries = ['amd','colamd','suitesparseconfig','cholmod'],
++ libraries = ['amd','colamd','suitesparseconfig','cholmod'] + LAPACK_LIB,
+ include_dirs = [SUITESPARSE_INC_DIR],
+ library_dirs = [SUITESPARSE_LIB_DIR],
+ sources = [ 'src/C/cholmod.c' ])
+@@ -218,7 +211,7 @@ else:
+ glob('src/C/SuiteSparse/AMD/Source/*.c') )
+
+ misc_solvers = Extension('misc_solvers',
+- libraries = LAPACK_LIB + BLAS_LIB,
++ libraries = ['m'] + LAPACK_LIB,
+ library_dirs = [ BLAS_LIB_DIR ],
+ define_macros = MACROS,
+ extra_link_args = BLAS_EXTRA_LINK_ARGS,
diff --git a/dev-python/cvxopt/metadata.xml b/dev-python/cvxopt/metadata.xml
new file mode 100644
index 000000000000..73822eb2153b
--- /dev/null
+++ b/dev-python/cvxopt/metadata.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>sci-mathematics@gentoo.org</email>
+ <name>Gentoo Mathematics Project</name>
+ </maintainer>
+ <longdescription lang="en">
+ CVXOPT is a software for convex optimization based on
+ the Python programming language. Its main purpose is to make the
+ development of software for convex optimization applications
+ straightforward.
+</longdescription>
+ <use>
+ <flag name="dsdp">Use interior point library
+ <pkg>sci-libs/dsdp</pkg></flag>
+ <flag name="glpk">Use GNU Linear Programming Kit
+ <pkg>sci-mathematics/glpk</pkg></flag>
+ </use>
+ <upstream>
+ <remote-id type="github">cvxopt/cvxopt</remote-id>
+ </upstream>
+</pkgmetadata>