AM_CHECK_PYTHON_HEADERS fails with Python 3

Bug #670100 reported by Cilyan Olowen on 2010-11-02
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Poppler Python Bindings
Undecided
Unassigned

Bug Description

In Python 3, the print function can no longer be used as a keyword. You need to enclose the parameter in parenthesis like any other function. As such, the following piece of code
import sys; print sys.prefix
is now a syntax error and should be replaced by
import sys; print(sys.prefix)

This error occurs twice in the python.m4 file (or acinclude.m4) and prevents ./configure from working with Python 3.

Rover (rspaulo) wrote :

I'm having problems with this.
The error still apeers. I already modificated acinclude.m4 with the parenthesis ad not worked. I get the same error msg.

My ./configure error msg:

checking for python version... 3.2
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python3.2/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python3.2/site-packages
checking for headers required to compile python extensions... File "<string>", line 1
    import sys; print sys.prefix
                        ^
SyntaxError: invalid syntax
  File "<string>", line 1
    import sys; print sys.exec_prefix
                        ^
SyntaxError: invalid syntax
not found
configure: error: could not find Python headers

My acinclude.m4 file:

AC_MSG_CHECKING(for headers required to compile python extensions)
dnl deduce PYTHON_INCLUDES
py_prefix=`$PYTHON -c "import sys; print(sys.prefix)"`
py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
if test "$py_prefix" != "$py_exec_prefix"; then
  PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_V$
fi

Is this correct?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers