Use shell wrappers to spawn python & python-config instead of symlinks
to fix magic applied by Python 3.4+ to symlinks.

Fixes: https://bugs.gentoo.org/show_bug.cgi?id=555752
---
 eclass/python-utils-r1.eclass | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index a292179..c1c5ea6 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -855,14 +855,25 @@ python_wrapper_setup() {
                fi
 
                # Python interpreter
-               ln -s "${PYTHON}" "${workdir}"/bin/python || die
-               ln -s python "${workdir}"/bin/python${pyver} || die
+               # note: we don't use symlinks because python likes to do some
+               # symlink reading magic that breaks stuff
+               # https://bugs.gentoo.org/show_bug.cgi?id=555752
+               cat > "${workdir}/bin/python" <<-_EOF_
+                       #!/bin/sh
+                       exec "${PYTHON}" "\${@}"
+               _EOF_
+               cp "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || 
die
+               chmod +x "${workdir}/bin/python" 
"${workdir}/bin/python${pyver}" || die
 
                local nonsupp=()
 
                # CPython-specific
                if [[ ${EPYTHON} == python* ]]; then
-                       ln -s "${PYTHON}-config" "${workdir}"/bin/python-config 
|| die
+                       cat > "${workdir}/bin/python-config" <<-_EOF_
+                               #!/bin/sh
+                               exec "${PYTHON}-config" "\${@}"
+                       _EOF_
+                       chmod +x "${workdir}/bin/python-config" || die
 
                        # Python 2.6+.
                        ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || 
die
-- 
2.4.6


Reply via email to