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
This commit is contained in:
Brecht Van Lommel
2024-01-11 14:27:03 +01:00
committed by Brecht Van Lommel
parent 6c9d77be3b
commit 6c6251e61c

View File

@@ -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)))
# 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