From 6c6251e61c0abc5bdc6ae0d975a4945e79d41afb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 11 Jan 2024 14:27:03 +0100 Subject: [PATCH] Fix: make format wrong results on Linux with system Python 3.12 There is currently a bug with autopep8 and Python 3.12, resulting in the contents of f-strings getting modified when they shouldn't. As a workaround, "make format" now uses the Python binary bundled with the precompiled libraries on Linux by default. This matches existing behavior on macOS and Windows. Pull Request: https://projects.blender.org/blender/blender/pulls/116993 --- GNUmakefile | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 3a55a1d7dbb..eb7f501522d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -199,11 +199,6 @@ ifndef DEPS_INSTALL_DIR endif endif -# Allow to use alternative binary (pypy3, etc) -ifndef PYTHON - PYTHON:=python3 -endif - # Set the LIBDIR, an empty string when not found. LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU}) ifeq (, $(LIBDIR)) @@ -228,11 +223,13 @@ ifeq (, $(wildcard $(LIBDIR)/python/lib/python$(PY_LIB_VERSION))) endif endif -# For macOS python3 is not installed by default, so fallback to python binary -# in libraries, or python 2 for running make update to get it. -ifeq ($(OS_NCASE),darwin) - ifeq (, $(shell command -v $(PYTHON))) - PYTHON:=$(LIBDIR)/python/bin/python$(PY_LIB_VERSION) +# Allow to use alternative binary (pypy3, etc) +ifndef PYTHON + # If not overriden, first try using Python from LIBDIR. + PYTHON:=$(LIBDIR)/python/bin/python$(PY_LIB_VERSION) + ifeq (, $(PYTHON)) + # If not available, use system python3 or python command. + PYTHON:=python3 ifeq (, $(shell command -v $(PYTHON))) PYTHON:=python endif