dev-lang/python: save/restore PYTHONDONTWRITEBYTECODE for USE=pgo

This avoids writing bytecode when we call has_version (or make
any other calls). But we do need it on for the 'emake' call
when building w/ USE=pgo.

Save & restore the value from the environment before/after
emake if building with PGO.

Closes: https://bugs.gentoo.org/831897
Signed-off-by: Sam James <sam@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/24642
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2022-03-19 00:05:46 +00:00
parent bf8943cc14
commit d5d4b491db
3 changed files with 24 additions and 0 deletions
+8
View File
@@ -236,6 +236,11 @@ src_compile() {
# https://bugs.gentoo.org/823728
export SETUPTOOLS_USE_DISTUTILS=stdlib
# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
# end up writing bytecode & violating sandbox.
# bug #831897
local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
if use pgo ; then
# bug 660358
local -x COLUMNS=80
@@ -248,6 +253,9 @@ src_compile() {
# in _sysconfigdata*
emake CPPFLAGS= CFLAGS= LDFLAGS=
# Restore saved value from above.
local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
# Work around bug 329499. See also bug 413751 and 457194.
if has_version dev-libs/libffi[pax-kernel]; then
pax-mark E python
@@ -226,6 +226,11 @@ src_compile() {
export SETUPTOOLS_USE_DISTUTILS=stdlib
export PYTHONSTRICTEXTENSIONBUILD=1
# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
# end up writing bytecode & violating sandbox.
# bug #831897
local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
if use pgo ; then
# bug 660358
local -x COLUMNS=80
@@ -238,6 +243,9 @@ src_compile() {
# in _sysconfigdata*
emake CPPFLAGS= CFLAGS= LDFLAGS=
# Restore saved value from above.
local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
# Work around bug 329499. See also bug 413751 and 457194.
if has_version dev-libs/libffi[pax-kernel]; then
pax-mark E python
+8
View File
@@ -221,6 +221,11 @@ src_compile() {
# https://bugs.gentoo.org/823728
export SETUPTOOLS_USE_DISTUTILS=stdlib
# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
# end up writing bytecode & violating sandbox.
# bug #831897
local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
if use pgo ; then
# bug 660358
local -x COLUMNS=80
@@ -233,6 +238,9 @@ src_compile() {
# in _sysconfigdata*
emake CPPFLAGS= CFLAGS= LDFLAGS=
# Restore saved value from above.
local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
# Work around bug 329499. See also bug 413751 and 457194.
if has_version dev-libs/libffi[pax-kernel]; then
pax-mark E python