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.eclass: Fix python_optimize to take all of sys.path
Date: Wed, 23 Oct 2019 10:10:45
Message-Id: 20191023101009.156716-1-mgorny@gentoo.org
1 Make sure to append NUL to every path in sys.path, rather than using
2 it as a separator between output entries. This fixes a bug when
3 the last path entry was silently discarded, and the function stopped
4 working with PyPy as a result.
5
6 Signed-off-by: Michał Górny <mgorny@g.o>
7 ---
8 eclass/python-utils-r1.eclass | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
12 index f8f51ecb694a..549dd5f2e56e 100644
13 --- a/eclass/python-utils-r1.eclass
14 +++ b/eclass/python-utils-r1.eclass
15 @@ -692,7 +692,7 @@ python_optimize() {
16 if [[ ${f} == /* && -d ${D%/}${f} ]]; then
17 set -- "${D%/}${f}" "${@}"
18 fi
19 - done < <("${PYTHON}" -c 'import sys; print("\0".join(sys.path))' || die)
20 + done < <("${PYTHON}" -c 'import sys; print("".join(x + "\0" for x in sys.path))' || die)
21
22 debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"
23 fi
24 --
25 2.23.0