Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 555594 - python-utils-r1 eclass - Add pythonN-config support to python_wrapper_setup
Summary: python-utils-r1 eclass - Add pythonN-config support to python_wrapper_setup
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on: 555752
Blocks:
  Show dependency tree
 
Reported: 2015-07-22 09:34 UTC by Jason Zaman
Modified: 2015-07-27 16:35 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Zaman gentoo-dev 2015-07-22 09:34:21 UTC
I am trying to bump sys-process/audit and it has python3 support now but its configure needs python3-config. On my system only pythonX.Y-config exist not the more generic pythonX-config. I could obviously patch configure.ac and use python_get_* from python-utils-r1 but I'd rather not have to.


Excerpt from build.log:

checking whether to create python bindings... no
checking whether to create python3 bindings... investigating
checking for python3-config... no
Python3 bindings were selected but python3-config was not found.
Please ensure that it's installed or pass --without-python3 to ./configure


Relevant section of configure.ac:

AC_MSG_CHECKING(whether to create python3 bindings)
AC_ARG_WITH(python3,
AS_HELP_STRING([--with-python3],[enable building python3 bindings]),
use_python3=$withval,
use_python3=auto)
if test x$use_python3 = xno ; then
        AC_MSG_RESULT(no)
else
        AC_MSG_RESULT(investigating)
        AC_PATH_PROG([use_python3], [python3-config], [no])
        if test ${use_python3} = no ; then
                if test ${withval} = yes ; then
                        echo "Python3 bindings were selected but python3-config was not found."
                        echo "Please ensure that it's installed or pass --without-python3 to ./configure"
                        exit 1
                fi
                echo "Python3 bindings will NOT be built"
        else
        echo "Python3 bindings WILL be built"
        use_python3=yes
        AC_PATH_PROG([PYTHON3], [python3], [no])
        if test "$PYTHON3" == "no" ; then
                echo "The python3 program was not found in the search path. Please ensure"
                echo "that it is installed and its directory is included in the search path or"
                echo "pass --without-python3 to ./configure."
                exit 1
        fi
        PYTHON3_CFLAGS=`python3-config --cflags 2> /dev/null`
        PYTHON3_LIBS=`python3-config --libs 2> /dev/null`
        PYTHON3_INCLUDES=`python3-config --includes 2> /dev/null`
        AC_SUBST([PYTHON3_PREFIX], ['${prefix}'])
        AC_SUBST([PYTHON3_EXEC_PREFIX], ['${exec_prefix}'])
        PYTHON3_DIR=`$PYTHON3 -c "import distutils.sysconfig; \
        print(distutils.sysconfig.get_python_lib(0,0,prefix='$PYTHON3_PREFIX'))"`
        PYTHON3_EXECDIR=`$PYTHON3 -c "import distutils.sysconfig; \
        print(distutils.sysconfig.get_python_lib(1,0,prefix='$PYTHON3_EXEC_PREFIX'))"`
        AC_SUBST(PYTHON3_CFLAGS)
        AC_SUBST(PYTHON3_LIBS)
        AC_SUBST(PYTHON3_INCLUDES)
        AC_SUBST(python3dir, $PYTHON3_DIR)
        AC_SUBST(py3execdir, $PYTHON3_EXECDIR)
        fi
fi
AM_CONDITIONAL(USE_PYTHON3, test ${use_python3} = "yes")
Comment 1 Jason Zaman gentoo-dev 2015-07-22 09:54:58 UTC
The following patch makes it work for me:

RCS file: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v
retrieving revision 1.83
diff -u -B -r1.83 python-utils-r1.eclass
--- python-utils-r1.eclass	4 Jul 2015 15:26:17 -0000	1.83
+++ python-utils-r1.eclass	22 Jul 2015 09:45:27 -0000
@@ -863,6 +863,7 @@
 		# CPython-specific
 		if [[ ${EPYTHON} == python* ]]; then
 			ln -s "${PYTHON}-config" "${workdir}"/bin/python-config || die
+			ln -s "${PYTHON}-config" "${workdir}"/bin/python${pyver}-config || die
 
 			# Python 2.6+.
 			ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die


log excerpt using the patch:

checking whether to create python bindings... no
checking whether to create python3 bindings... investigating
checking for python3-config... /var/tmp/portage/sys-process/audit-2.4.3/temp/python3.4/bin/python3-config
Python3 bindings WILL be built
checking for python3... /var/tmp/portage/sys-process/audit-2.4.3/temp/python3.4/bin/python3
Comment 2 Jason Zaman gentoo-dev 2015-07-23 10:40:33 UTC
For some reason I dont get yet, the symlink works for pythonX.Y-config but not for pythonX-config python-config. the prefix is wrong.
interestingly, python-config is wrong for python3.4 but 2.7 is fine. Perhaps because 3.4 has venv stuff built in? One way to fix might be to make a small bash script to just exec /usr/bin/python3.4-config instead of symlink, but I wonder if this indicates a bigger underlying problem?

I made the test ebuild output some stuff:
python_configure() {
    for pc in python-config python3.4-config python3-config python2.7-config python2-config;
    do
        elog "which ${pc}: $(which ${pc})"
        elog "${pc} --prefix: $(${pc} --prefix)"
        elog "${pc} --includes: $(${pc} --includes)"
        elog "${pc} --libs: $(${pc} --libs)"
    done
}
python_foreach_impl python_configure



 * python3_4: running python_configure

 * which python-config: /var/tmp/portage/sys-process/audit-2.4.3/temp/python3.4/bin/python-config
 * python-config --prefix: /var/tmp/portage/sys-process/audit-2.4.3/temp/python3.4
 * python-config --includes: -I/var/tmp/portage/sys-process/audit-2.4.3/temp/python3.4/include/python3.4 -I/var/tmp/portage/sys-process/audit-2.4.3/temp/python3.4/include/python3.4
 * python-config --libs: -lpthread -ldl  -lutil -lm  -lpython3.4

 * which python3.4-config: /usr/bin/python3.4-config
 * python3.4-config --prefix: /usr
 * python3.4-config --includes: -I/usr/include/python3.4 -I/usr/include/python3.4
 * python3.4-config --libs: -lpthread -ldl  -lutil -lm  -lpython3.4

 * which python3-config: /var/tmp/portage/sys-process/audit-2.4.3/temp/python3.4/bin/python3-config
 * python3-config --prefix: /var/tmp/portage/sys-process/audit-2.4.3/temp/python3.4
 * python3-config --includes: -I/var/tmp/portage/sys-process/audit-2.4.3/temp/python3.4/include/python3.4 -I/var/tmp/portage/sys-process/audit-2.4.3/temp/python3.4/include/python3.4
 * python3-config --libs: -lpthread -ldl  -lutil -lm  -lpython3.4

 * which python2.7-config: /usr/bin/python2.7-config
 * python2.7-config --prefix: /usr
 * python2.7-config --includes: -I/usr/include/python2.7 -I/usr/include/python2.7
 * python2.7-config --libs: -lpython2.7 -lpthread -ldl -lutil -lm


 * python2_7: running python_configure

 * which python-config: /var/tmp/portage/sys-process/audit-2.4.3/temp/python2.7/bin/python-config
 * python-config --prefix: /usr
 * python-config --includes: -I/usr/include/python2.7 -I/usr/include/python2.7
 * python-config --libs: -lpython2.7 -lpthread -ldl -lutil -lm

 * which python3.4-config: /usr/bin/python3.4-config
 * python3.4-config --prefix: /usr
 * python3.4-config --includes: -I/usr/include/python3.4 -I/usr/include/python3.4
 * python3.4-config --libs: -lpthread -ldl  -lutil -lm  -lpython3.4

 * which python2.7-config: /usr/bin/python2.7-config
 * python2.7-config --prefix: /usr
 * python2.7-config --includes: -I/usr/include/python2.7 -I/usr/include/python2.7
 * python2.7-config --libs: -lpython2.7 -lpthread -ldl -lutil -lm

 * which python2-config: /var/tmp/portage/sys-process/audit-2.4.3/temp/python2.7/bin/python2-config
 * python2-config --prefix: /usr
 * python2-config --includes: -I/usr/include/python2.7 -I/usr/include/python2.7
 * python2-config --libs: -lpython2.7 -lpthread -ldl -lutil -lm
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-07-23 19:11:54 UTC
Could you open a separate bug for the python-config, please? It seems too important to hide beneath adding pythonX-config.

We should also add pythonY and pythonY-config via nonsupp=() that are going to explicitly forbid ebuilds from using python3 when 2.* is selected, and the other way around.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-07-27 16:35:33 UTC
  27 Jul 2015; Michał Górny <mgorny@gentoo.org> python-utils-r1.eclass:
  python_wrapper_setup(): wrap pythonN-config as well as suggested by PEP and
  required by some applications, bug #555594.