Skip to content

Commit a8223c5

Browse files
author
nouiz
committed
Allow to compile with python 2.7 and with EPD python version.
1 parent 821f429 commit a8223c5

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

plearn/python/PythonIncludes.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,23 @@
7373
# error "Symbols PL_USE_NUMARRAY and PL_USE_NUMPY are mutually exclusive; they should not both be defined"
7474
#endif
7575

76-
#if PL_PYTHON_VERSION >= 260
76+
#if PL_PYTHON_VERSION >= 270
77+
78+
#include <python2.7/Python.h>
79+
#include <python2.7/compile.h> // define PyCodeObject
80+
#include <python2.7/eval.h> // for accessing PyEval_EvalCode: not included by default
81+
#ifdef PL_USE_NUMARRAY
82+
# include <python2.7/numarray/libnumarray.h>
83+
#else
84+
# ifdef PL_USE_NUMPY
85+
# pragma GCC system_header //suppress all warnings/errors for numpy
86+
# include <libnumarray.h>
87+
# else
88+
# error "should use either NumPy (preferred) or NUMARRAY (deprecated)"
89+
# endif //def PL_USE_NUMPY
90+
#endif //def PL_USE_NUMARRAY
91+
92+
#elif PL_PYTHON_VERSION >= 260
7793

7894
#include <python2.6/Python.h>
7995
#include <python2.6/compile.h> // define PyCodeObject

pymake.config.model

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ options_choices = [
267267
[ 'double', 'float' ],
268268

269269
# [ 'throwerrors', 'exiterrors' ],
270-
[ 'autopython', 'python23', 'python24', 'python25', 'python26','nopython' ],
270+
[ 'autopython', 'python23', 'python24', 'python25', 'python26','python27', 'nopython' ],
271271

272272
[ 'blas', 'noblas' ],
273273
[ 'defblas', 'nolibblas', 'p3blas', 'p4blas', 'athlonblas', 'pentiumblas',
@@ -413,6 +413,10 @@ if not 'nopython' in optionargs:
413413
getpyver = toolkit.command_output('python%s -V' % python_version)
414414
if len(getpyver) == 1:
415415
tokens = getpyver[0].split()
416+
if len(tokens) > 3 and tokens[2]=="--" and tokens[3] == 'EPD':
417+
# This is a EPD installation of python
418+
# Version are like Python 2.7.2 -- EPD 7.1-2 (64-bit)
419+
tokens = tokens[:2]
416420
if len(tokens) == 2:
417421
foundver = tokens[1]
418422
tokens = foundver.split('.')
@@ -809,6 +813,9 @@ pymakeOption( name = 'python25',
809813
pymakeOption( name = 'python26',
810814
description = 'the installed version of python is 2.6.X',
811815
cpp_definitions = ['PL_PYTHON_VERSION=260'] )
816+
pymakeOption( name = 'python27',
817+
description = 'the installed version of python is 2.7.X',
818+
cpp_definitions = ['PL_PYTHON_VERSION=270'] )
812819
pymakeOption( name = 'nopython',
813820
description = 'compile w/o python')
814821

0 commit comments

Comments
 (0)