GNOME Bugzilla – Bug 696648
[patch] Use distutils.sysconfig to retrieve the python include path with PyPy
Last modified: 2013-04-04 08:23:45 UTC
Created attachment 239872 [details] [review] patch-v1 python.m4 fails with PyPy. This uses distutils to find the right path (in case of PyPy) before the macro, so the macro search logic gets skipped. It might be that using distutils also works with CPython and this can be moved into python.m4... but I wanted to keep the change small.
Wouldn't it be better to entirely replace the sys.exec_prefix based detection in m4/python.m4 with the "ask distutils" approach? Or is distutils not available with cpython?
Distutils is included with CPython. I'll look into it then.
Created attachment 240570 [details] [review] patch-v2 (python.m4 change)
Ah, I just realized that this will break on Ubuntu, as the paths are slightly different due to multi-arching. So I'll combine the PyPy specific approach of your first patch with putting everything into python.m4 like in your second patch. Thanks!
Comment on attachment 240570 [details] [review] patch-v2 (python.m4 change) Nevermind, this works fine. it prefers $PYTHON_CONFIG if present. Thanks!
Have only looked quickly, but does attachment #240570 [details] not break AM_CHECK_PYTHON_LIBS which requires AM_CHECK_PYTHON_HEADERS to fill in ${py_prefix} (which the patch removes)? Maybe AM_CHECK_PYTHON_LIBS needs a simple sprinkling of 'distutils.sysconfig.PREFIX' too? Also, if I'm not mistaken line 78 (py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"`) in AM_CHECK_PYTHON_LIBS can be removed, I'm suspecting a copy/paste error on my part, sorry...
Created attachment 240574 [details] [review] AM_CHECK_PYTHON_LIBS patch Good catch. What about this fix?
Review of attachment 240574 [details] [review]: (In reply to comment #7) > Good catch. What about this fix? Looks good to me, thanks!
Comment on attachment 240574 [details] [review] AM_CHECK_PYTHON_LIBS patch Thanks!