dev-python/pycparser: trick tests into using CPP variable
authorMike Gilbert <floppym@gentoo.org>
Sat, 2 May 2020 21:27:50 +0000 (17:27 -0400)
committerMike Gilbert <floppym@gentoo.org>
Sat, 2 May 2020 21:27:50 +0000 (17:27 -0400)
Closes: https://bugs.gentoo.org/719934
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
dev-python/pycparser/pycparser-2.20.ebuild

index 7f1f79c16a8e90a4568250b295c17ac585463a96..1dcff2020fcbd49c356db8539c9f7ed1980c1955 100644 (file)
@@ -5,7 +5,7 @@ EAPI=7
 
 PYTHON_COMPAT=( python2_7 python3_{6,7,8} pypy3 )
 
-inherit distutils-r1
+inherit distutils-r1 toolchain-funcs
 
 DESCRIPTION="C parser and AST generator written in Python"
 HOMEPAGE="https://github.com/eliben/pycparser"
@@ -41,9 +41,20 @@ python_compile() {
 }
 
 python_test() {
+       # Trick the tests into using CPP variable
+       # https://bugs.gentoo.org/719934
+       local CPP="$(tc-getCPP)"
+       mkdir -p "${T}"/bin || die
+       cat > "${T}"/bin/cpp <<-EOF || die
+       #!/bin/sh
+       exec ${CPP} "\$@"
+       EOF
+       chmod +x "${T}"/bin/cpp || die
+       local -x PATH="${T}/bin:${PATH}"
+
        # change workdir to avoid '.' import
        cd tests || die
-       "${EPYTHON}" -m unittest discover -v || die "Tests fail with ${EPYTHON}"
+       ${EPYTHON} -m unittest discover -v || die "Tests fail with ${EPYTHON}"
 }
 
 python_install() {