Created
August 19, 2016 05:07
-
-
Save chadvoegele/2cf681c34be609ea1be135bf624208b5 to your computer and use it in GitHub Desktop.
python-spams.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -Naur trunka/linalg/linalg.h trunk/linalg/linalg.h | |
--- trunka/linalg/linalg.h 2016-04-24 08:33:27.339077788 -0500 | |
+++ trunk/linalg/linalg.h 2016-04-24 08:34:03.125869367 -0500 | |
@@ -1679,7 +1679,7 @@ | |
up.copy(u); | |
} | |
lambda+=theta*norm; | |
- if isnan(lambda) { | |
+ if (isnan(lambda)) { | |
std::cerr << "eigLargestSymApprox failed" << std::endl; | |
exit(1); | |
} | |
diff -Naur trunka/swig/python/mkpy trunk/swig/python/mkpy | |
--- trunka/swig/python/mkpy 2016-04-24 08:33:27.339077788 -0500 | |
+++ trunk/swig/python/mkpy 2016-04-24 08:34:03.125869367 -0500 | |
@@ -10,8 +10,8 @@ | |
exec /cygdrive/c/MinGW/msys/1.0/bin/bash $0 $optx $* | |
fi | |
-INC="-I. -Ispams/linalg -Ispams/prox -Ispams/decomp -Ispams/dictLearn -I/usr/include/python2.7/" | |
-INC_PYTHON=-I/usr/include/python2.6 | |
+INC_PYTHON=$(python -c "from distutils.sysconfig import get_python_inc; print('-I'+get_python_inc())") | |
+INC="-I. -Ispams/linalg -Ispams/prox -Ispams/decomp -Ispams/dictLearn ${INC_PYTHON}" | |
XCCFLAGS="" | |
XLINKFLAGS="" | |
# on MacOS, use following definition instead. | |
@@ -88,7 +88,7 @@ | |
err=0 | |
for nom in $lst; do | |
[ $flg_swig -ne 0 ] && { | |
- swig -c++ -python $OPT_DBG -o ${nom}_wrap.cpp $nom.i | |
+ swig -c++ -py3 -python $OPT_DBG -o ${nom}_wrap.cpp $nom.i | |
[ $? -ne 0 ] && exit | |
} | |
if [ -e $nom.cpp ]; then | |
diff -Naur trunka/swig/python/numpy.i trunk/swig/python/numpy.i | |
--- trunka/swig/python/numpy.i 2016-04-24 08:33:27.342411134 -0500 | |
+++ trunk/swig/python/numpy.i 2016-04-24 08:34:03.125869367 -0500 | |
@@ -107,9 +107,11 @@ | |
if (PyDict_Check( py_obj)) return "dict" ; | |
if (PyList_Check( py_obj)) return "list" ; | |
if (PyTuple_Check( py_obj)) return "tuple" ; | |
+%#if PY_MAJOR_VERSION < 3 | |
if (PyFile_Check( py_obj)) return "file" ; | |
if (PyModule_Check( py_obj)) return "module" ; | |
if (PyInstance_Check(py_obj)) return "instance" ; | |
+%#endif | |
return "unkown type"; | |
} | |
diff -Naur trunka/swig/python/py_typemaps.i trunk/swig/python/py_typemaps.i | |
--- trunka/swig/python/py_typemaps.i 2016-04-24 08:33:27.342411134 -0500 | |
+++ trunk/swig/python/py_typemaps.i 2016-04-24 08:34:24.975945317 -0500 | |
@@ -64,13 +64,11 @@ | |
%typemap(in,numinputs=0,fragment="NumPy_Fragments") (Vector<DATA_TYPE> **ARGOUT_VECTOR) | |
(Vector<DATA_TYPE> *data_temp) | |
{ | |
- # argout in | |
$1 = &data_temp; | |
} | |
%typemap(argout) (Vector<DATA_TYPE> **ARGOUT_VECTOR ) | |
{ | |
- # test argout | |
if(data_temp$argnum != NULL) { | |
npy_intp n = data_temp$argnum->n(); | |
npy_intp dims[1] = {n}; | |
@@ -142,13 +140,11 @@ | |
%typemap(in,numinputs=0,fragment="NumPy_Fragments") (Matrix<DATA_TYPE> **ARGOUT_MATRIX) | |
(Matrix<DATA_TYPE> *data_temp) | |
{ | |
- # argout in | |
$1 = &data_temp; | |
} | |
%typemap(argout) (Matrix<DATA_TYPE> **ARGOUT_MATRIX ) | |
{ | |
- # test argout | |
if(data_temp$argnum != NULL) { | |
npy_intp m = data_temp$argnum->m(); | |
npy_intp n = data_temp$argnum->n(); | |
@@ -328,7 +324,6 @@ | |
} | |
%typemap(argout) (SpMatrix<DATA_TYPE> **ARGOUT_SPMATRIX ) | |
{ | |
-# test argout | |
if(data_temp$argnum != NULL) { | |
npy_intp m = data_temp$argnum->m(); | |
npy_intp n = data_temp$argnum->n(); | |
diff -Naur trunka/swig/python/setup.py.in trunk/swig/python/setup.py.in | |
--- trunka/swig/python/setup.py.in 2016-04-24 08:33:27.342411134 -0500 | |
+++ trunk/swig/python/setup.py.in 2016-04-24 08:34:03.125869367 -0500 | |
@@ -1,13 +1,14 @@ | |
import os | |
#os.environ['DISTUTILS_DEBUG'] = "1" | |
from distutils.core import setup, Extension | |
+from distutils.sysconfig import get_python_inc | |
import distutils.util | |
import numpy | |
# includes numpy : package numpy.distutils , numpy.get_include() | |
# python setup.py build --inplace | |
# python setup.py install --prefix=dist, | |
-incs = ['.'] + map(lambda x: os.path.join('spams',x),[ 'linalg', 'prox', 'decomp', 'dictLearn']) + [numpy.get_include()] + ['/usr/include/python2.7/'] | |
+incs = ['.'] + [os.path.join('spams',x) for x in [ 'linalg', 'prox', 'decomp', 'dictLearn']] + [numpy.get_include()] + [get_python_inc()] | |
osname = distutils.util.get_platform() | |
cc_flags = ['-fPIC', '-fopenmp'] | |
@@ -78,11 +78,6 @@ | |
# scripts = ['test_spams.py'], | |
data_files = [ | |
('test',['test_spams.py', 'test_decomp.py', 'test_dictLearn.py', 'test_linalg.py', 'test_prox.py', 'test_utils.py']), | |
- ('doc',['doc_spams.pdf', 'python-interface.pdf']), | |
- ('doc/sphinx/_sources',mkhtml('_sources')), | |
- ('doc/sphinx/_static',mkhtml('_static')), | |
- ('doc/sphinx',mkhtml()), | |
- ('doc/html',mkhtml(base = 'html')), | |
('extdata',['boat.png', 'lena.png']) | |
], | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment