Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH python-utils-r1 1/4] Use shell wrappers instead of symlinks for python{,-config}
Date: Sat, 25 Jul 2015 10:38:48
Message-Id: 1437820664-28757-2-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHSET python-utils-r1] python & python-config wrapper cleanup by "Michał Górny"
1 Use shell wrappers to spawn python & python-config instead of symlinks
2 to fix magic applied by Python 3.4+ to symlinks.
3
4 Fixes: https://bugs.gentoo.org/show_bug.cgi?id=555752
5 ---
6 eclass/python-utils-r1.eclass | 17 ++++++++++++++---
7 1 file changed, 14 insertions(+), 3 deletions(-)
8
9 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
10 index a292179..c1c5ea6 100644
11 --- a/eclass/python-utils-r1.eclass
12 +++ b/eclass/python-utils-r1.eclass
13 @@ -855,14 +855,25 @@ python_wrapper_setup() {
14 fi
15
16 # Python interpreter
17 - ln -s "${PYTHON}" "${workdir}"/bin/python || die
18 - ln -s python "${workdir}"/bin/python${pyver} || die
19 + # note: we don't use symlinks because python likes to do some
20 + # symlink reading magic that breaks stuff
21 + # https://bugs.gentoo.org/show_bug.cgi?id=555752
22 + cat > "${workdir}/bin/python" <<-_EOF_
23 + #!/bin/sh
24 + exec "${PYTHON}" "\${@}"
25 + _EOF_
26 + cp "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die
27 + chmod +x "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die
28
29 local nonsupp=()
30
31 # CPython-specific
32 if [[ ${EPYTHON} == python* ]]; then
33 - ln -s "${PYTHON}-config" "${workdir}"/bin/python-config || die
34 + cat > "${workdir}/bin/python-config" <<-_EOF_
35 + #!/bin/sh
36 + exec "${PYTHON}-config" "\${@}"
37 + _EOF_
38 + chmod +x "${workdir}/bin/python-config" || die
39
40 # Python 2.6+.
41 ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die
42 --
43 2.4.6

Replies