public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] python-utils-r1.eclass: Fix python_optimize to take all of sys.path
@ 2019-10-23 10:10 Michał Górny
  0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2019-10-23 10:10 UTC (permalink / raw
  To: gentoo-dev; +Cc: python, Michał Górny

Make sure to append NUL to every path in sys.path, rather than using
it as a separator between output entries.  This fixes a bug when
the last path entry was silently discarded, and the function stopped
working with PyPy as a result.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/python-utils-r1.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index f8f51ecb694a..549dd5f2e56e 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -692,7 +692,7 @@ python_optimize() {
 			if [[ ${f} == /* && -d ${D%/}${f} ]]; then
 				set -- "${D%/}${f}" "${@}"
 			fi
-		done < <("${PYTHON}" -c 'import sys; print("\0".join(sys.path))' || die)
+		done < <("${PYTHON}" -c 'import sys; print("".join(x + "\0" for x in sys.path))' || die)
 
 		debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"
 	fi
-- 
2.23.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-23 10:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-23 10:10 [gentoo-dev] [PATCH] python-utils-r1.eclass: Fix python_optimize to take all of sys.path Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox