commit:     04aae426f32c1a5ac8c8ff0237a4f00d981c8eac
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Apr 21 18:14:27 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 22 00:37:50 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04aae426

media-gfx/blender: bump 4.3.2-r3, 4.2.9, drop 4.1.1-r5, 3.6.18-r1

Bug: https://bugs.gentoo.org/949564
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-gfx/blender/Manifest                         |   3 +-
 media-gfx/blender/blender-3.6.18-r1.ebuild         | 449 ---------------
 ...lender-4.1.1-r5.ebuild => blender-4.2.9.ebuild} |  60 +-
 ...der-4.3.2-r2.ebuild => blender-4.3.2-r3.ebuild} |   3 +
 .../blender/files/blender-4.2.9-python3.12.patch   |  68 +++
 .../blender/files/blender-4.2.9-python3.12_1.patch |  39 ++
 .../blender/files/blender-4.2.9-python3.13.patch   | 626 +++++++++++++++++++++
 media-gfx/blender/metadata.xml                     |   3 -
 8 files changed, 766 insertions(+), 485 deletions(-)

diff --git a/media-gfx/blender/Manifest b/media-gfx/blender/Manifest
index 7c9e4778abea..cd7f4d2f807b 100644
--- a/media-gfx/blender/Manifest
+++ b/media-gfx/blender/Manifest
@@ -1,6 +1,5 @@
-DIST blender-3.6.18.tar.xz 67900952 BLAKE2B 
d4a619197abc3e4969846913f3c88cd64fd679bbefe007354af6ba2e83d47a8fcd27b3bcbaf6d850d28960eedeb3c50ff9336d0e61fd488d4916b6628bfd67dd
 SHA512 
48a8b3e8b2fe75305061d7cb9b7b8491cef4f23fbd809d1fc34663a4f97f487d6e7e6e92848110fe6aa5a2fed18a2c1a2a0c1c928aa813e2456f7786681eae60
-DIST blender-4.1.1.tar.xz 82146268 BLAKE2B 
1ab4a6c1046851ef619394c62fc73794430dc091e2cab26d3d1d542e9d4519889e9b9731606385e9dc8657448ca3827875526f4a57dd1b5c326a73d8a6f9be8d
 SHA512 
13ad0cdd09879b5c28554faca5a54172f43dc3dcb749d2d1723d3e89e741e6255179af3bd88309b735e058b9b350191e44f3158e882e55f1cedea70b8b21540e
 DIST blender-4.2.4.tar.xz 72804204 BLAKE2B 
613ae4671cc9263d18fe988b07e8744eb04f67fe53f1c14ad3fbc7d80c58a577e7753871ca775cd40ab5f26ef2bc9030cda57012dda0c4785769f04263aea15b
 SHA512 
1f61c1866aaa680c91fc6e3402b1e10533c8cce32572ffb825c53dc7c15ca51f1157a32d10134ca9e612fbf719406421ccc920b2d8ddd2993675784797381c6a
+DIST blender-4.2.9.tar.xz 72811408 BLAKE2B 
b33227a3d2ab97578d919d37419b5486e049d42404f7d3e0e4f096dae813004749facba571b3525de10c0a9b9d7c9d67a0eefcf7200a3975e4e5b6874c4d47b0
 SHA512 
71d08f22ee8dd25f9ad260ab16fc7266586a92de5b6ba784a825c179d75ac423a570f62ddccc51a1f22bc86dbee9a628472b26dcd35d2a97b7d0bd951fceeee8
 DIST blender-4.3.2.tar.xz 74473996 BLAKE2B 
9a5c8973561f3296b0ec35990ab4951e34f7c0dd5bee3dd120a49989dc8ca7ebfc9610654e8be9d14463af2197626f490324cdd03118db755f5d0b1f7acce375
 SHA512 
44697faf9acc2c1e75783d432a1a0040339c3445834961a995e95974d4088e75ee5cb647a3908125259d1910d180910e5bc50d34d40d35f33e03197893581477
 DIST blender-4.4.1.tar.xz 85518840 BLAKE2B 
a482a2d246222b5395f5e1c5cfa9fd2dbab0d5dc33145ec5cfaae3e7d7083e65034e1f5b54bc4605ab45905d08c2938c97ab488659d822997ee853c9e34fcc55
 SHA512 
db6b117b841890b172f4d13c6f38b73f36aae5648ed74f5233eb311328d467644005bd24fb4f9c7ea9b2dad7ff584fc7b3831f5ab34f3f900555c68f4af5b901
 DIST blender-assets-4.3.2.tar.xz 8763844 BLAKE2B 
0eca4a7bfb630096dfe9dd5f8c8071d9ca8c1aaab560a8694df4add507c3e8a641a4e0ad197f110b639d2d399a23c5c25af6fb060ca3316e1a44d286f6b23f7e
 SHA512 
ce9483b3e5b83d1b29bdfa3a14f7be7176e85ec50a414213a67badcce3c24cd8da349fee22b08cc95d6e5906420bbcd5c5f15855445da6364e6054f968c20678

diff --git a/media-gfx/blender/blender-3.6.18-r1.ebuild 
b/media-gfx/blender/blender-3.6.18-r1.ebuild
deleted file mode 100644
index bd3462a8b278..000000000000
--- a/media-gfx/blender/blender-3.6.18-r1.ebuild
+++ /dev/null
@@ -1,449 +0,0 @@
-# Copyright 1999-2025 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_10 python3_11 )
-
-inherit check-reqs cmake flag-o-matic pax-utils python-single-r1 
toolchain-funcs xdg-utils
-
-DESCRIPTION="3D Creation/Animation/Publishing System"
-HOMEPAGE="https://www.blender.org";
-
-if [[ ${PV} = *9999* ]] ; then
-       # Subversion is needed for downloading unit test files
-       inherit git-r3 subversion
-       EGIT_REPO_URI="https://projects.blender.org/blender/blender.git";
-       
ADDONS_EGIT_REPO_URI="https://projects.blender.org/blender/blender-addons.git";
-else
-       SRC_URI="https://download.blender.org/source/${P}.tar.xz";
-       # Update these between major releases.
-       TEST_TARBALL_VERSION="$(ver_cut 1-2).0"
-       # SRC_URI+=" test? ( 
https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${PN}-${TEST_TARBALL_VERSION}-tests.tar.xz
 )"
-       KEYWORDS="amd64 ~arm ~arm64"
-fi
-
-LICENSE="GPL-3+ cycles? ( Apache-2.0 )"
-SLOT="${PV%.*}"
-IUSE="+bullet +dds +fluid +openexr +tbb
-       alembic collada +color-management cuda +cycles cycles-bin-kernels
-       debug doc +embree +ffmpeg +fftw +gmp jack jemalloc jpeg2k
-       man +nanovdb ndof nls openal +oidn +openmp +openpgl +opensubdiv
-       +openvdb optix osl +pdf +potrace +pugixml pulseaudio sdl
-       +sndfile test +tiff valgrind wayland X"
-RESTRICT="!test? ( test )"
-
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
-       alembic? ( openexr )
-       cuda? ( cycles )
-       cycles? ( openexr tiff )
-       fluid? ( tbb )
-       openvdb? ( tbb )
-       optix? ( cuda )
-       osl? ( cycles )
-       test? ( color-management )"
-
-# Library versions for official builds can be found in the blender source 
directory in:
-# build_files/build_environment/install_deps.sh
-RDEPEND="${PYTHON_DEPS}
-       dev-libs/boost:=[nls?]
-       dev-libs/lzo:2=
-       $(python_gen_cond_dep '
-               dev-python/cython[${PYTHON_USEDEP}]
-               dev-python/numpy[${PYTHON_USEDEP}]
-               dev-python/zstandard[${PYTHON_USEDEP}]
-               dev-python/requests[${PYTHON_USEDEP}]
-       ')
-       media-libs/freetype:=[brotli]
-       media-libs/libepoxy:=
-       media-libs/libjpeg-turbo:=
-       media-libs/libpng:=
-       media-libs/libsamplerate
-       >=media-libs/openimageio-2.4.6.0:=
-       sys-libs/zlib:=
-       virtual/glu
-       virtual/libintl
-       virtual/opengl
-       alembic? ( >=media-gfx/alembic-1.8.3-r2[boost(+),hdf(+)] )
-       collada? ( >=media-libs/opencollada-1.6.68 )
-       color-management? ( media-libs/opencolorio:= )
-       cuda? ( dev-util/nvidia-cuda-toolkit:= )
-       embree? ( >=media-libs/embree-3.10.0:=[raymask] )
-       ffmpeg? ( 
<media-video/ffmpeg-7:=[encode(+),lame(-),jpeg2k?,opus,theora,vorbis,vpx,x264,xvid]
 )
-       fftw? ( sci-libs/fftw:3.0= )
-       gmp? ( dev-libs/gmp[cxx] )
-       jack? ( virtual/jack )
-       jemalloc? ( dev-libs/jemalloc:= )
-       jpeg2k? ( media-libs/openjpeg:2= )
-       ndof? (
-               app-misc/spacenavd
-               dev-libs/libspnav
-       )
-       nls? ( virtual/libiconv )
-       openal? ( media-libs/openal )
-       oidn? ( >=media-libs/oidn-1.4.1 )
-       openexr? (
-               >=dev-libs/imath-3.1.4-r2:=
-               >=media-libs/openexr-3:0=
-       )
-       openpgl? ( media-libs/openpgl:0/0.5 )
-       opensubdiv? ( >=media-libs/opensubdiv-3.4.0 )
-       openvdb? (
-               <media-gfx/openvdb-11.0.0:=[nanovdb?]
-               dev-libs/c-blosc:=
-       )
-       optix? ( <dev-libs/optix-7.5.0 )
-       osl? ( <media-libs/osl-1.13:= )
-       pdf? ( media-libs/libharu )
-       potrace? ( media-gfx/potrace )
-       pugixml? ( dev-libs/pugixml )
-       pulseaudio? ( media-libs/libpulse )
-       sdl? ( media-libs/libsdl2[sound,joystick] )
-       sndfile? ( media-libs/libsndfile )
-       tbb? ( dev-cpp/tbb:= )
-       tiff? ( media-libs/tiff:= )
-       valgrind? ( dev-debug/valgrind )
-       wayland? (
-               >=dev-libs/wayland-1.12
-               >=dev-libs/wayland-protocols-1.15
-               >=x11-libs/libxkbcommon-0.2.0
-               media-libs/mesa[wayland]
-               sys-apps/dbus
-       )
-       X? (
-               x11-libs/libX11
-               x11-libs/libXi
-               x11-libs/libXxf86vm
-       )
-"
-
-DEPEND="${RDEPEND}
-       dev-cpp/eigen:=
-"
-
-BDEPEND="
-       virtual/pkgconfig
-       doc? (
-               app-text/doxygen[dot]
-               dev-python/sphinx[latex]
-               dev-texlive/texlive-bibtexextra
-               dev-texlive/texlive-fontsextra
-               dev-texlive/texlive-fontutils
-               dev-texlive/texlive-latex
-               dev-texlive/texlive-latexextra
-       )
-       nls? ( sys-devel/gettext )
-       wayland? (
-               dev-util/wayland-scanner
-       )
-"
-
-blender_check_requirements() {
-       [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
-
-       if use doc; then
-               CHECKREQS_DISK_BUILD="4G" check-reqs_pkg_pretend
-       fi
-}
-
-blender_get_version() {
-       # Get blender version from blender itself.
-       BV=$(grep "BLENDER_VERSION " 
source/blender/blenkernel/BKE_blender_version.h | cut -d " " -f 3; assert)
-       if ((${BV:0:1} < 3)) ; then
-               # Add period (290 -> 2.90).
-               BV=${BV:0:1}.${BV:1}
-       else
-               # Add period and skip the middle number (301 -> 3.1)
-               BV=${BV:0:1}.${BV:2}
-       fi
-}
-
-pkg_pretend() {
-       blender_check_requirements
-}
-
-pkg_setup() {
-       blender_check_requirements
-       python-single-r1_pkg_setup
-}
-
-src_unpack() {
-       if [[ ${PV} = *9999* ]] ; then
-               git-r3_src_unpack
-
-               git-r3_fetch "${ADDONS_EGIT_REPO_URI}"
-               git-r3_checkout "${ADDONS_EGIT_REPO_URI}" "${S}/scripts/addons"
-
-               if use test; then
-                       
TESTS_SVN_URL=https://svn.blender.org/svnroot/bf-blender/trunk/lib/tests
-                       subversion_fetch ${TESTS_SVN_URL} ../lib/tests
-               fi
-               
ASSETS_SVN_URL=https://svn.blender.org/svnroot/bf-blender/trunk/lib/assets
-               subversion_fetch ${ASSETS_SVN_URL} ../lib/assets
-       else
-               default
-
-               # BUG upstream returns LFS references instead of files
-               # if use test; then
-               #       #The tests are downloaded from: 
https://svn.blender.org/svnroot/bf-blender/tags/blender-${SLOT}-release/lib/tests
-               #       mkdir -p lib || die
-               #       mv 
"${WORKDIR}/blender-${TEST_TARBALL_VERSION}-tests/tests" lib || die
-               # fi
-       fi
-
-}
-
-src_prepare() {
-       cmake_src_prepare
-
-       blender_get_version
-
-       # Disable MS Windows help generation. The variable doesn't do what it
-       # it sounds like.
-       sed -e "s|GENERATE_HTMLHELP      = YES|GENERATE_HTMLHELP      = NO|" \
-               -i doc/doxygen/Doxyfile || die
-
-       # Prepare icons and .desktop files for slotting.
-       sed -e "s|blender.svg|blender-${BV}.svg|" -i 
source/creator/CMakeLists.txt || die
-       sed -e "s|blender-symbolic.svg|blender-${BV}-symbolic.svg|" -i 
source/creator/CMakeLists.txt || die
-       sed -e "s|blender.desktop|blender-${BV}.desktop|" -i 
source/creator/CMakeLists.txt || die
-
-       sed -e "s|Name=Blender|Name=Blender ${PV}|" -i 
release/freedesktop/blender.desktop || die
-       sed -e "s|Exec=blender|Exec=blender-${BV}|" -i 
release/freedesktop/blender.desktop || die
-       sed -e "s|Icon=blender|Icon=blender-${BV}|" -i 
release/freedesktop/blender.desktop || die
-
-       mv release/freedesktop/icons/scalable/apps/blender.svg 
"release/freedesktop/icons/scalable/apps/blender-${BV}.svg" || die
-       mv release/freedesktop/icons/symbolic/apps/blender-symbolic.svg 
"release/freedesktop/icons/symbolic/apps/blender-${BV}-symbolic.svg" || die
-       mv release/freedesktop/blender.desktop 
"release/freedesktop/blender-${BV}.desktop" || die
-
-       if use test; then
-               # Without this the tests will try to use /usr/bin/blender and 
/usr/share/blender/ to run the tests.
-               sed -e "s|set(TEST_INSTALL_DIR.*|set(TEST_INSTALL_DIR 
${T}/usr)|g" -i tests/CMakeLists.txt || die
-               sed -e "s|string(REPLACE.*|set(TEST_INSTALL_DIR ${T}/usr)|g" -i 
build_files/cmake/Modules/GTestTesting.cmake || die
-       fi
-}
-
-src_configure() {
-       # -Werror=odr, -Werror=lto-type-mismatch
-       # https://bugs.gentoo.org/859607
-       # https://projects.blender.org/blender/blender/issues/120444
-       filter-lto
-
-       # Workaround for bug #922600
-       append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
-
-       append-lfs-flags
-       blender_get_version
-
-       local mycmakeargs=(
-               -DBUILD_SHARED_LIBS=OFF
-               -DPYTHON_INCLUDE_DIR="$(python_get_includedir)"
-               -DPYTHON_LIBRARY="$(python_get_library_path)"
-               -DPYTHON_VERSION="${EPYTHON/python/}"
-               -DWITH_ALEMBIC=$(usex alembic)
-               -DWITH_ASSERT_ABORT=$(usex debug)
-               -DWITH_BOOST=ON
-               -DWITH_BULLET=$(usex bullet)
-               -DWITH_CODEC_FFMPEG=$(usex ffmpeg)
-               -DWITH_CODEC_SNDFILE=$(usex sndfile)
-               -DWITH_CXX_GUARDEDALLOC=$(usex debug)
-               -DWITH_CYCLES=$(usex cycles)
-               -DWITH_CYCLES_CUDA_BINARIES=$(usex cycles-bin-kernels)
-               -DWITH_CYCLES_DEVICE_CUDA=$(usex cuda TRUE FALSE)
-               -DWITH_CYCLES_DEVICE_OPTIX=$(usex optix)
-               -DWITH_CYCLES_EMBREE=$(usex embree)
-               -DWITH_CYCLES_OSL=$(usex osl)
-               -DWITH_CYCLES_PATH_GUIDING=$(usex openpgl)
-               -DWITH_CYCLES_STANDALONE=OFF
-               -DWITH_CYCLES_STANDALONE_GUI=OFF
-               -DWITH_DOC_MANPAGE=$(usex man)
-               -DWITH_FFTW3=$(usex fftw)
-               -DWITH_GHOST_WAYLAND=$(usex wayland)
-               -DWITH_GHOST_WAYLAND_APP_ID="blender-${BV}"
-               -DWITH_GHOST_WAYLAND_DBUS=$(usex wayland)
-               -DWITH_GHOST_WAYLAND_DYNLOAD=OFF
-               -DWITH_GHOST_WAYLAND_LIBDECOR=OFF
-               -DWITH_GHOST_X11=$(usex X)
-               -DWITH_GMP=$(usex gmp)
-               -DWITH_GTESTS=$(usex test)
-               -DWITH_HARU=$(usex pdf)
-               -DWITH_HEADLESS=$($(use X || use wayland) && echo OFF || echo 
ON)
-               -DWITH_INSTALL_PORTABLE=OFF
-               -DWITH_IMAGE_DDS=$(usex dds)
-               -DWITH_IMAGE_OPENEXR=$(usex openexr)
-               -DWITH_IMAGE_OPENJPEG=$(usex jpeg2k)
-               -DWITH_IMAGE_TIFF=$(usex tiff)
-               -DWITH_INPUT_NDOF=$(usex ndof)
-               -DWITH_INTERNATIONAL=$(usex nls)
-               -DWITH_JACK=$(usex jack)
-               -DWITH_MEM_JEMALLOC=$(usex jemalloc)
-               -DWITH_MEM_VALGRIND=$(usex valgrind)
-               -DWITH_MOD_FLUID=$(usex fluid)
-               -DWITH_MOD_OCEANSIM=$(usex fftw)
-               -DWITH_NANOVDB=$(usex nanovdb)
-               -DWITH_OPENAL=$(usex openal)
-               -DWITH_OPENCOLLADA=$(usex collada)
-               -DWITH_OPENCOLORIO=$(usex color-management)
-               -DWITH_OPENIMAGEDENOISE=$(usex oidn)
-               -DWITH_OPENMP=$(usex openmp)
-               -DWITH_OPENSUBDIV=$(usex opensubdiv)
-               -DWITH_OPENVDB=$(usex openvdb)
-               -DWITH_OPENVDB_BLOSC=$(usex openvdb)
-               -DWITH_POTRACE=$(usex potrace)
-               -DWITH_PUGIXML=$(usex pugixml)
-               -DWITH_PULSEAUDIO=$(usex pulseaudio)
-               -DWITH_PYTHON_INSTALL=OFF
-               -DWITH_SDL=$(usex sdl)
-               -DWITH_STATIC_LIBS=OFF
-               -DWITH_SYSTEM_EIGEN3=ON
-               -DWITH_SYSTEM_FREETYPE=ON
-               -DWITH_SYSTEM_LZO=ON
-               -DWITH_TBB=$(usex tbb)
-               -DWITH_USD=OFF
-               -DWITH_XR_OPENXR=OFF
-       )
-
-       if use optix; then
-               mycmakeargs+=(
-                       -DCYCLES_RUNTIME_OPTIX_ROOT_DIR="${EPREFIX}"/opt/optix
-                       -DOPTIX_ROOT_DIR="${EPREFIX}"/opt/optix
-               )
-       fi
-
-       # This is currently needed on arm64 to get the NEON SIMD wrapper to 
compile the code successfully
-       use arm64 && append-flags -flax-vector-conversions
-
-       append-flags $(usex debug '-DDEBUG' '-DNDEBUG')
-
-       if tc-is-gcc ; then
-               # These options only exist when GCC is detected.
-               # We disable these to respect the user's choice of linker.
-               mycmakeargs+=(
-                       -DWITH_LINKER_GOLD=OFF
-                       -DWITH_LINKER_LLD=OFF
-               )
-       fi
-
-       cmake_src_configure
-}
-
-src_test() {
-       # A lot of tests needs to have access to the installed data files.
-       # So install them into the image directory now.
-       DESTDIR="${T}" cmake_build install
-
-       blender_get_version
-       # Define custom blender data/script file paths not be able to find them 
otherwise during testing.
-       # (Because the data is in the image directory and it will default to 
look in /usr/share)
-       export BLENDER_SYSTEM_SCRIPTS="${T}/usr/share/blender/${BV}/scripts"
-       export BLENDER_SYSTEM_DATAFILES="${T}/usr/share/blender/${BV}/datafiles"
-
-       # Sanity check that the script and datafile path is valid.
-       # If they are not vaild, blender will fallback to the default path 
which is not what we want.
-       [ -d "$BLENDER_SYSTEM_SCRIPTS" ] || die "The custom script path is 
invalid, fix the ebuild!"
-       [ -d "$BLENDER_SYSTEM_DATAFILES" ] || die "The custom datafiles path is 
invalid, fix the ebuild!"
-
-       cmake_src_test
-
-       # Clean up the image directory for src_install
-       rm -fr "${T}"/usr || die
-}
-
-src_install() {
-       blender_get_version
-
-       # Pax mark blender for hardened support.
-       pax-mark m "${BUILD_DIR}"/bin/blender
-
-       cmake_src_install
-
-       if use man; then
-               # Slot the man page
-               mv "${ED}/usr/share/man/man1/blender.1" 
"${ED}/usr/share/man/man1/blender-${BV}.1" || die
-       fi
-
-       if use doc; then
-               # Define custom blender data/script file paths. Otherwise 
Blender will not be able to find them during doc building.
-               # (Because the data is in the image directory and it will 
default to look in /usr/share)
-               export 
BLENDER_SYSTEM_SCRIPTS=${ED}/usr/share/blender/${BV}/scripts
-               export 
BLENDER_SYSTEM_DATAFILES=${ED}/usr/share/blender/${BV}/datafiles
-
-               # Workaround for binary drivers.
-               addpredict /dev/ati
-               addpredict /dev/dri
-               addpredict /dev/nvidiactl
-
-               einfo "Generating Blender C/C++ API docs ..."
-               cd "${CMAKE_USE_DIR}"/doc/doxygen || die
-               doxygen -u Doxyfile || die
-               doxygen || die "doxygen failed to build API docs."
-
-               cd "${CMAKE_USE_DIR}" || die
-               einfo "Generating (BPY) Blender Python API docs ..."
-               "${BUILD_DIR}"/bin/blender --background --python 
doc/python_api/sphinx_doc_gen.py -noaudio || die "sphinx failed."
-
-               cd "${CMAKE_USE_DIR}"/doc/python_api || die
-               sphinx-build sphinx-in BPY_API || die "sphinx failed."
-
-               docinto "html/API/python"
-               dodoc -r "${CMAKE_USE_DIR}"/doc/python_api/BPY_API/.
-
-               docinto "html/API/blender"
-               dodoc -r "${CMAKE_USE_DIR}"/doc/doxygen/html/.
-       fi
-
-       # Fix doc installdir
-       docinto html
-       dodoc "${CMAKE_USE_DIR}"/release/text/readme.html
-       rm -r "${ED}"/usr/share/doc/blender || die
-
-       python_optimize "${ED}/usr/share/blender/${BV}/scripts"
-
-       mv "${ED}/usr/bin/blender-thumbnailer" 
"${ED}/usr/bin/blender-${BV}-thumbnailer" || die
-       mv "${ED}/usr/bin/blender" "${ED}/usr/bin/blender-${BV}" || die
-}
-
-pkg_postinst() {
-       elog
-       elog "Blender uses python integration. As such, may have some"
-       elog "inherent risks with running unknown python scripts."
-       elog
-       elog "It is recommended to change your blender temp directory"
-       elog "from /tmp to /home/user/tmp or another tmp file under your"
-       elog "home directory. This can be done by starting blender, then"
-       elog "changing the 'Temporary Files' directory in Blender preferences."
-       elog
-
-       if use osl; then
-               ewarn ""
-               ewarn "OSL is know to cause runtime segfaults if Mesa has been 
linked to"
-               ewarn "an other LLVM version than what OSL is linked to."
-               ewarn "See https://bugs.gentoo.org/880671 for more details"
-               ewarn ""
-       fi
-
-       if ! use python_single_target_python3_10; then
-               elog "You are building Blender with a newer python version than"
-               elog "supported by this version upstream."
-               elog "If you experience breakages with e.g. plugins, please 
switch to"
-               elog "python_single_target_python3_10 instead."
-               elog "Bug: https://bugs.gentoo.org/737388";
-               elog
-       fi
-
-       xdg_icon_cache_update
-       xdg_mimeinfo_database_update
-       xdg_desktop_database_update
-}
-
-pkg_postrm() {
-       xdg_icon_cache_update
-       xdg_mimeinfo_database_update
-       xdg_desktop_database_update
-
-       ewarn ""
-       ewarn "You may want to remove the following directory."
-       ewarn "~/.config/${PN}/${SLOT}/cache/"
-       ewarn "It may contain extra render kernels not tracked by portage"
-       ewarn ""
-}

diff --git a/media-gfx/blender/blender-4.1.1-r5.ebuild 
b/media-gfx/blender/blender-4.2.9.ebuild
similarity index 90%
rename from media-gfx/blender/blender-4.1.1-r5.ebuild
rename to media-gfx/blender/blender-4.2.9.ebuild
index cbe668c639ba..572fa4852873 100644
--- a/media-gfx/blender/blender-4.1.1-r5.ebuild
+++ b/media-gfx/blender/blender-4.2.9.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{11..12} )
+PYTHON_COMPAT=( python3_{11..13} )
 # NOTE must match media-libs/osl
 LLVM_COMPAT=( {15..18} )
 LLVM_OPTIONAL=1
@@ -18,7 +18,6 @@ if [[ ${PV} = *9999* ]] ; then
        inherit git-r3
        EGIT_REPO_URI="https://projects.blender.org/blender/blender.git";
        EGIT_SUBMODULES=( '*' '-lib/*' )
-       
ADDONS_EGIT_REPO_URI="https://projects.blender.org/blender/blender-addons.git";
        RESTRICT="!test? ( test )"
 else
        SRC_URI="
@@ -28,7 +27,7 @@ else
        #               
https://projects.blender.org/blender/blender-test-data/archive/blender-v$(ver_cut
 1-2)-release.tar.gz
        #       )
        # "
-       KEYWORDS="amd64 ~arm ~arm64"
+       KEYWORDS="~amd64 ~arm ~arm64"
        RESTRICT="test" # the test archive returns LFS references.
 fi
 
@@ -36,8 +35,8 @@ LICENSE="GPL-3+ cycles? ( Apache-2.0 )"
 SLOT="${PV%.*}"
 IUSE="
        alembic +bullet collada +color-management cuda +cycles 
+cycles-bin-kernels
-       debug doc +embree experimental +ffmpeg +fftw +fluid +gmp gnome hip jack
-       jemalloc jpeg2k man +nanovdb ndof nls +oidn openal +openexr +openmp 
openpgl
+       debug doc +embree +ffmpeg +fftw +fluid +gmp gnome hip jack
+       jemalloc jpeg2k man +nanovdb ndof nls +oidn openal +openexr +openmp 
+openpgl
        +opensubdiv +openvdb optix osl +otf +pdf +potrace +pugixml pulseaudio
        renderdoc sdl +sndfile +tbb test +tiff valgrind vulkan wayland +webp X
 "
@@ -97,7 +96,6 @@ RDEPEND="${PYTHON_DEPS}
        nls? ( virtual/libiconv )
        openal? ( media-libs/openal )
        oidn? ( >=media-libs/oidn-2.1.0 )
-       oneapi? ( dev-libs/intel-compute-runtime:=[l0] )
        openexr? (
                >=dev-libs/imath-3.1.7:=
                >=media-libs/openexr-3.2.1:0=
@@ -182,6 +180,9 @@ PATCHES=(
        "${FILESDIR}/${PN}-4.0.2-CUDA_NVCC_FLAGS.patch"
        "${FILESDIR}/${PN}-4.1.1-FindLLVM.patch"
        "${FILESDIR}/${PN}-4.1.1-numpy.patch"
+       "${FILESDIR}/${PN}-4.2.9-python3.12.patch"
+       "${FILESDIR}/${PN}-4.2.9-python3.13.patch"
+       "${FILESDIR}/${PN}-4.2.9-python3.12_1.patch"
 )
 
 blender_check_requirements() {
@@ -206,12 +207,6 @@ blender_get_version() {
 
 pkg_pretend() {
        blender_check_requirements
-
-       if use oneapi; then
-               einfo "The Intel oneAPI support is rudimentary."
-               einfo ""
-               einfo "Please report any bugs you find to 
https://bugs.gentoo.org/";
-       fi
 }
 
 pkg_setup() {
@@ -229,9 +224,6 @@ src_unpack() {
                        EGIT_SUBMODULES+=( '-tests/*' )
                fi
                git-r3_src_unpack
-
-               git-r3_fetch "${ADDONS_EGIT_REPO_URI}"
-               git-r3_checkout "${ADDONS_EGIT_REPO_URI}" "${S}/scripts/addons"
        else
                default
 
@@ -315,6 +307,7 @@ src_configure() {
                -DWITH_BULLET=$(usex bullet)
                -DWITH_CODEC_FFMPEG=$(usex ffmpeg)
                -DWITH_CODEC_SNDFILE=$(usex sndfile)
+               -DWITH_CPU_CHECK=no
 
                -DWITH_CYCLES=$(usex cycles)
 
@@ -325,9 +318,6 @@ src_configure() {
                -DWITH_CYCLES_DEVICE_HIP="$(usex hip)"
                -DWITH_CYCLES_HIP_BINARIES=$(usex hip $(usex 
cycles-bin-kernels))
 
-               -DWITH_CYCLES_DEVICE_ONEAPI="$(usex oneapi)"
-               -DWITH_CYCLES_ONEAPI_BINARIES="$(usex oneapi $(usex 
cycles-bin-kernels))"
-
                -DWITH_CYCLES_HYDRA_RENDER_DELEGATE="no" # TODO: package Hydra
                -DWITH_CYCLES_EMBREE="$(usex embree)"
                -DWITH_CYCLES_OSL=$(usex osl)
@@ -337,7 +327,6 @@ src_configure() {
 
                -DWITH_DOC_MANPAGE=$(usex man)
                -DWITH_DRACO="no" # TODO: Package Draco
-               -DWITH_EXPERIMENTAL_FEATURES="$(usex experimental)"
                -DWITH_FFTW3=$(usex fftw)
                -DWITH_GHOST_WAYLAND=$(usex wayland)
                -DWITH_GHOST_WAYLAND_DYNLOAD="no"
@@ -477,15 +466,16 @@ src_test() {
        DESTDIR="${T}" cmake_build install
 
        blender_get_version
-       # Define custom blender data/script file paths not be able to find them 
otherwise during testing.
-       # (Because the data is in the image directory and it will default to 
look in /usr/share)
-       export BLENDER_SYSTEM_SCRIPTS="${T}/usr/share/blender/${BV}/scripts"
-       export BLENDER_SYSTEM_DATAFILES="${T}/usr/share/blender/${BV}/datafiles"
+       # By default, blender will look for system scripts and data in
+       # /usr/share/, but until this is installed, they are not necessarily
+       # available there.  Use this to have blender search the intermediate
+       # install directory instead.
+       export BLENDER_SYSTEM_RESOURCES="${T}/usr/share/blender/${BV}"
 
-       # Sanity check that the script and datafile path is valid.
-       # If they are not vaild, blender will fallback to the default path 
which is not what we want.
-       [ -d "$BLENDER_SYSTEM_SCRIPTS" ] || die "The custom script path is 
invalid, fix the ebuild!"
-       [ -d "$BLENDER_SYSTEM_DATAFILES" ] || die "The custom datafiles path is 
invalid, fix the ebuild!"
+       # Brake check:  Make sure the above path is valid.
+       # If not, blender will fallback to the default path which is not what
+       # we want.
+       [ -d "$BLENDER_SYSTEM_RESOURCES" ] || die "The custom script path is 
invalid, fix the ebuild!"
 
        if use cuda; then
                cuda_add_sandbox -w
@@ -497,6 +487,8 @@ src_test() {
                xdg_environment_reset
        fi
 
+       addwrite /dev/dri
+
        cmake_src_test
 
        # Clean up the image directory for src_install
@@ -524,10 +516,16 @@ src_install() {
        fi
 
        if use doc; then
-               # Define custom blender data/script file paths. Otherwise 
Blender will not be able to find them during doc building.
-               # (Because the data is in the image directory and it will 
default to look in /usr/share)
-               export 
BLENDER_SYSTEM_SCRIPTS=${ED}/usr/share/blender/${BV}/scripts
-               export 
BLENDER_SYSTEM_DATAFILES=${ED}/usr/share/blender/${BV}/datafiles
+               # By default, blender will look for system scripts and data in
+               # /usr/share/, but until this is installed, they are not 
necessarily
+               # available there.  Use this to have blender search the 
intermediate
+               # install directory instead.
+               export BLENDER_SYSTEM_RESOURCES="${ED}/usr/share/blender/${BV}"
+
+               # Brake check:  Make sure the above path is valid.
+               # If not, blender will fallback to the default path which is 
not what
+               # we want.
+               [ -d "$BLENDER_SYSTEM_RESOURCES" ] || die "The custom script 
path is invalid, fix the ebuild!"
 
                # Workaround for binary drivers.
                addpredict /dev/ati

diff --git a/media-gfx/blender/blender-4.3.2-r2.ebuild 
b/media-gfx/blender/blender-4.3.2-r3.ebuild
similarity index 99%
rename from media-gfx/blender/blender-4.3.2-r2.ebuild
rename to media-gfx/blender/blender-4.3.2-r3.ebuild
index 6e5459ec540a..eed06b9229a2 100644
--- a/media-gfx/blender/blender-4.3.2-r2.ebuild
+++ b/media-gfx/blender/blender-4.3.2-r3.ebuild
@@ -242,6 +242,9 @@ PATCHES=(
        "${FILESDIR}/${PN}-4.0.2-FindClang.patch"
        "${FILESDIR}/${PN}-4.1.1-FindLLVM.patch"
        "${FILESDIR}/${PN}-4.1.1-numpy.patch"
+       "${FILESDIR}/${PN}-4.2.9-python3.12.patch"
+       "${FILESDIR}/${PN}-4.2.9-python3.13.patch"
+       "${FILESDIR}/${PN}-4.2.9-python3.12_1.patch"
        "${FILESDIR}/${PN}-4.3.2-ffmpeg7.patch"
        "${FILESDIR}/${PN}-4.3.2-openvdb-12.patch"
        "${FILESDIR}/${PN}-4.3.2-optix-8.1.0.patch"

diff --git a/media-gfx/blender/files/blender-4.2.9-python3.12.patch 
b/media-gfx/blender/files/blender-4.2.9-python3.12.patch
new file mode 100644
index 000000000000..94d0875cf67d
--- /dev/null
+++ b/media-gfx/blender/files/blender-4.2.9-python3.12.patch
@@ -0,0 +1,68 @@
+From 1865de1c738a1a1ead520fbd38487815e13906e9 Mon Sep 17 00:00:00 2001
+From: Campbell Barton <campb...@blender.org>
+Date: Thu, 28 Nov 2024 12:04:45 +1100
+Subject: [PATCH] Fix #129926: Crash with Python 3.12 & Manta flow
+
+Python 3.12 no longer supports calls to PyImport_AppendInittab
+once initialized.
+
+The call was redundant as Blender's `bpy_internal_modules` already
+includes the "manta" module.
+
+Resolve by disabling the call when Python's lifecycle isn't being
+managed by manta-flow.
+---
+ extern/mantaflow/helper/pwrapper/registry.cpp | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/extern/mantaflow/helper/pwrapper/registry.cpp 
b/extern/mantaflow/helper/pwrapper/registry.cpp
+index b4206a41dea..3ad7475d0e3 100644
+--- a/extern/mantaflow/helper/pwrapper/registry.cpp
++++ b/extern/mantaflow/helper/pwrapper/registry.cpp
+@@ -112,7 +112,7 @@ class WrapperRegistry {
+                            const std::string &name,
+                            Manta::PbArgs &args,
+                            Manta::PbClass *parent);
+-  void construct(const std::string &scriptname, const vector<string> &args);
++  void construct(bool python_lifecycle, const std::string &scriptname, const 
vector<string> &args);
+   void cleanup();
+   void renameObjects();
+   void runPreInit(PyObject *name_space);
+@@ -566,7 +566,9 @@ PyObject *WrapperRegistry::createPyObject(const string 
&classname,
+ }
+ 
+ // prepare typeinfo and register python module
+-void WrapperRegistry::construct(const string &scriptname, const 
vector<string> &args)
++void WrapperRegistry::construct(const bool python_lifecycle,
++                                const string &scriptname,
++                                const vector<string> &args)
+ {
+   mScriptName = scriptname;
+   this->args = args;
+@@ -575,8 +577,15 @@ void WrapperRegistry::construct(const string &scriptname, 
const vector<string> &
+   registerMeta();
+   registerDummyTypes();
+ 
+-  // work around for certain gcc versions, cast to char*
+-  PyImport_AppendInittab((char *)gDefaultModuleName.c_str(), 
PyInit_manta_main);
++  // Don't extend the init-tab when Python is already initialized.
++  // Since Python 3.12 this isn't supported and will crash.
++  //
++  // When `python_lifecycle` is false (when manta-flow is embedded), it's the 
responsibility
++  // of the application embedding this code to include #PyInit_manta_main in 
the init-tab.
++  if (python_lifecycle) {
++    // work around for certain gcc versions, cast to char*
++    PyImport_AppendInittab((char *)gDefaultModuleName.c_str(), 
PyInit_manta_main);
++  }
+ }
+ 
+ inline PyObject *castPy(PyTypeObject *p)
+@@ -711,7 +720,7 @@ void setup(const bool python_lifecycle,
+            const std::vector<std::string> &args,
+            PyObject *name_space)
+ {
+-  WrapperRegistry::instance().construct(filename, args);
++  WrapperRegistry::instance().construct(python_lifecycle, filename, args);
+   if (python_lifecycle) {
+     Py_Initialize();
+   }

diff --git a/media-gfx/blender/files/blender-4.2.9-python3.12_1.patch 
b/media-gfx/blender/files/blender-4.2.9-python3.12_1.patch
new file mode 100644
index 000000000000..0312e786861c
--- /dev/null
+++ b/media-gfx/blender/files/blender-4.2.9-python3.12_1.patch
@@ -0,0 +1,39 @@
+From f60f2b769b1d43d253d470c99f8555e90cb45fd9 Mon Sep 17 00:00:00 2001
+From: Campbell Barton <campb...@blender.org>
+Date: Mon, 21 Oct 2024 20:45:35 +1100
+Subject: [PATCH] Unbreak building with Python 3.12
+
+Support for 3.13 [0] broke 3.12.
+
+[0]: d9f38fca5ffe29136cd6f390e318ad8455864582
+---
+ source/blender/python/generic/py_capi_utils.cc | 2 +-
+ source/blender/python/generic/py_capi_utils.hh | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/source/blender/python/generic/py_capi_utils.cc 
b/source/blender/python/generic/py_capi_utils.cc
+index 74c829d717e..d6c58a5c6eb 100644
+--- a/source/blender/python/generic/py_capi_utils.cc
++++ b/source/blender/python/generic/py_capi_utils.cc
+@@ -39,7 +39,7 @@
+ #  include "BLI_math_base.h" /* isfinite() */
+ #endif
+ 
+-#if PY_VERSION_HEX <= 0x030c0000 /* <=3.12 */
++#if PY_VERSION_HEX < 0x030d0000 /* <3.13 */
+ #  define PyLong_AsInt _PyLong_AsInt
+ #  define PyUnicode_CompareWithASCIIString _PyUnicode_EqualToASCIIString
+ #endif
+diff --git a/source/blender/python/generic/py_capi_utils.hh 
b/source/blender/python/generic/py_capi_utils.hh
+index 81740e0d0ad..29222d35c2c 100644
+--- a/source/blender/python/generic/py_capi_utils.hh
++++ b/source/blender/python/generic/py_capi_utils.hh
+@@ -339,7 +339,7 @@ uint64_t PyC_Long_AsU64(PyObject *value);
+ /* inline so type signatures match as expected */
+ Py_LOCAL_INLINE(int32_t) PyC_Long_AsI32(PyObject *value)
+ {
+-#if PY_VERSION_HEX <= 0x030c0000 /* <=3.12 */
++#if PY_VERSION_HEX < 0x030d0000 /* <3.13 */
+   return (int32_t)_PyLong_AsInt(value);
+ #else
+   return (int32_t)PyLong_AsInt(value);

diff --git a/media-gfx/blender/files/blender-4.2.9-python3.13.patch 
b/media-gfx/blender/files/blender-4.2.9-python3.13.patch
new file mode 100644
index 000000000000..0dd6f4b95b4d
--- /dev/null
+++ b/media-gfx/blender/files/blender-4.2.9-python3.13.patch
@@ -0,0 +1,626 @@
+From d9f38fca5ffe29136cd6f390e318ad8455864582 Mon Sep 17 00:00:00 2001
+From: Campbell Barton <campb...@blender.org>
+Date: Fri, 18 Oct 2024 12:23:34 +1100
+Subject: [PATCH] PyAPI: support Python 3.13
+
+- `_PySet_NextEntry` has been removed, use generic iterator access
+  which will has some additional overhead as it needs to create
+  an iterator to access the values.
+
+- Add v3.13 compatibility defines to account for renaming:
+  _PyObject_LookupAttr -> PyObject_GetOptionalAttr
+  _PyLong_AsInt -> PyLong_AsInt
+
+- Unfortunately use of Python's internal API needs to be used to
+  inspect op-codes in `bpy_driver.cc`.
+
+Testing GLTF/FBX IO there isn't any significant performance impact
+from these changes.
+
+Resolves #123871.
+---
+ .../blender/python/bmesh/bmesh_py_ops_call.cc |  16 +-
+ source/blender/python/generic/py_capi_rna.cc  | 140 ++++++++++--------
+ .../blender/python/generic/py_capi_utils.cc   |  56 ++++---
+ .../blender/python/generic/py_capi_utils.hh   |   4 +
+ .../blender/python/generic/python_compat.hh   |  10 +-
+ .../blender/python/gpu/gpu_py_framebuffer.cc  |   6 +-
+ source/blender/python/intern/bpy.cc           |  48 +++---
+ source/blender/python/intern/bpy_driver.cc    |  37 ++++-
+ .../python/intern/bpy_library_write.cc        |  27 ++--
+ source/blender/python/intern/bpy_rna.cc       |   6 +-
+ 10 files changed, 218 insertions(+), 132 deletions(-)
+
+diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.cc 
b/source/blender/python/bmesh/bmesh_py_ops_call.cc
+index d5a2e6b02ad..624e4d02e98 100644
+--- a/source/blender/python/bmesh/bmesh_py_ops_call.cc
++++ b/source/blender/python/bmesh/bmesh_py_ops_call.cc
+@@ -548,11 +548,12 @@ static int bpy_slot_from_py(BMesh *bm,
+           break;
+         }
+         case BMO_OP_SLOT_SUBTYPE_MAP_EMPTY: {
+-          if (PySet_Size(value) > 0) {
++          if (PySet_GET_SIZE(value) > 0) {
++            PyObject *it = PyObject_GetIter(value);
+             PyObject *arg_key;
+-            Py_ssize_t arg_pos = 0;
+-            Py_ssize_t arg_hash = 0;
+-            while (_PySet_NextEntry(value, &arg_pos, &arg_key, &arg_hash)) {
++            while ((arg_key = PyIter_Next(it))) {
++              /* Borrow from the set. */
++              Py_DECREF(arg_key);
+ 
+               if (bpy_slot_from_py_elem_check((BPy_BMElem *)arg_key,
+                                               bm,
+@@ -561,11 +562,16 @@ static int bpy_slot_from_py(BMesh *bm,
+                                               slot_name,
+                                               "invalid key in set") == -1)
+               {
+-                return -1; /* error is set in bpy_slot_from_py_elem_check() */
++                /* Error is set in #bpy_slot_from_py_elem_check(). */
++                break;
+               }
+ 
+               BMO_slot_map_empty_insert(bmop, slot, ((BPy_BMElem 
*)arg_key)->ele);
+             }
++            Py_DECREF(it);
++            if (arg_key) {
++              return -1;
++            }
+           }
+           break;
+         }
+diff --git a/source/blender/python/generic/py_capi_rna.cc 
b/source/blender/python/generic/py_capi_rna.cc
+index 11827fa0836..a41e474f619 100644
+--- a/source/blender/python/generic/py_capi_rna.cc
++++ b/source/blender/python/generic/py_capi_rna.cc
+@@ -75,60 +75,66 @@ BLI_bitmap *pyrna_enum_bitmap_from_set(const 
EnumPropertyItem *items,
+                                        int bitmap_size,
+                                        const char *error_prefix)
+ {
+-  /* Set looping. */
+-  Py_ssize_t pos = 0;
+-  Py_ssize_t hash = 0;
+-  PyObject *key;
+-
++  BLI_assert(PySet_Check(value));
+   BLI_bitmap *bitmap = BLI_BITMAP_NEW(bitmap_size, __func__);
+ 
+-  while (_PySet_NextEntry(value, &pos, &key, &hash)) {
+-    const char *param = PyUnicode_AsUTF8(key);
+-    if (param == nullptr) {
+-      PyErr_Format(PyExc_TypeError,
+-                   "%.200s expected a string, not %.200s",
+-                   error_prefix,
+-                   Py_TYPE(key)->tp_name);
+-      goto error;
+-    }
++  if (PySet_GET_SIZE(value) > 0) {
++    /* Set looping. */
++    PyObject *it = PyObject_GetIter(value);
++    PyObject *key;
++    while ((key = PyIter_Next(it))) {
++      /* Borrow from the set. */
++      Py_DECREF(key);
+ 
+-    int ret;
+-    if (pyrna_enum_value_from_id(items, param, &ret, error_prefix) == -1) {
+-      goto error;
+-    }
++      const char *param = PyUnicode_AsUTF8(key);
++      if (param == nullptr) {
++        PyErr_Format(PyExc_TypeError,
++                     "%.200s expected a string, not %.200s",
++                     error_prefix,
++                     Py_TYPE(key)->tp_name);
++        break;
++      }
+ 
+-    int index = ret;
++      int ret;
++      if (pyrna_enum_value_from_id(items, param, &ret, error_prefix) == -1) {
++        break;
++      }
+ 
+-    if (type_convert_sign) {
+-      if (type_size == 2) {
+-        union {
+-          signed short as_signed;
+-          ushort as_unsigned;
+-        } ret_convert;
+-        ret_convert.as_signed = (signed short)ret;
+-        index = int(ret_convert.as_unsigned);
+-      }
+-      else if (type_size == 1) {
+-        union {
+-          signed char as_signed;
+-          uchar as_unsigned;
+-        } ret_convert;
+-        ret_convert.as_signed = (signed char)ret;
+-        index = int(ret_convert.as_unsigned);
+-      }
+-      else {
+-        BLI_assert_unreachable();
++      int index = ret;
++
++      if (type_convert_sign) {
++        if (type_size == 2) {
++          union {
++            signed short as_signed;
++            ushort as_unsigned;
++          } ret_convert;
++          ret_convert.as_signed = (signed short)ret;
++          index = int(ret_convert.as_unsigned);
++        }
++        else if (type_size == 1) {
++          union {
++            signed char as_signed;
++            uchar as_unsigned;
++          } ret_convert;
++          ret_convert.as_signed = (signed char)ret;
++          index = int(ret_convert.as_unsigned);
++        }
++        else {
++          BLI_assert_unreachable();
++        }
+       }
++      BLI_assert(index < bitmap_size);
++      BLI_BITMAP_ENABLE(bitmap, index);
++    }
++    Py_DECREF(it);
++
++    if (key) {
++      MEM_freeN(bitmap);
++      bitmap = nullptr;
+     }
+-    BLI_assert(index < bitmap_size);
+-    BLI_BITMAP_ENABLE(bitmap, index);
+   }
+ 
+   return bitmap;
+-
+-error:
+-  MEM_freeN(bitmap);
+-  return nullptr;
+ }
+ 
+ int pyrna_enum_bitfield_from_set(const EnumPropertyItem *items,
+@@ -136,32 +142,40 @@ int pyrna_enum_bitfield_from_set(const EnumPropertyItem 
*items,
+                                  int *r_value,
+                                  const char *error_prefix)
+ {
++  BLI_assert(PySet_Check(value));
+   /* Set of enum items, concatenate all values with OR. */
+-  int ret, flag = 0;
+-
+-  /* Set looping. */
+-  Py_ssize_t pos = 0;
+-  Py_ssize_t hash = 0;
+-  PyObject *key;
++  int flag = 0;
+ 
+   *r_value = 0;
+ 
+-  while (_PySet_NextEntry(value, &pos, &key, &hash)) {
+-    const char *param = PyUnicode_AsUTF8(key);
++  PyObject *key = nullptr;
++  if (PySet_GET_SIZE(value) > 0) {
++    /* Set looping. */
++    PyObject *it = PyObject_GetIter(value);
++    while ((key = PyIter_Next(it))) {
++      /* Borrow from the set. */
++      Py_DECREF(key);
+ 
+-    if (param == nullptr) {
+-      PyErr_Format(PyExc_TypeError,
+-                   "%.200s expected a string, not %.200s",
+-                   error_prefix,
+-                   Py_TYPE(key)->tp_name);
++      const char *param = PyUnicode_AsUTF8(key);
++      if (param == nullptr) {
++        PyErr_Format(PyExc_TypeError,
++                     "%.200s expected a string, not %.200s",
++                     error_prefix,
++                     Py_TYPE(key)->tp_name);
++        break;
++      }
++
++      int ret;
++      if (pyrna_enum_value_from_id(items, param, &ret, error_prefix) == -1) {
++        break;
++      }
++
++      flag |= ret;
++    }
++    Py_DECREF(it);
++    if (key) {
+       return -1;
+     }
+-
+-    if (pyrna_enum_value_from_id(items, param, &ret, error_prefix) == -1) {
+-      return -1;
+-    }
+-
+-    flag |= ret;
+   }
+ 
+   *r_value = flag;
+diff --git a/source/blender/python/generic/py_capi_utils.cc 
b/source/blender/python/generic/py_capi_utils.cc
+index 3311064e7c5..74c829d717e 100644
+--- a/source/blender/python/generic/py_capi_utils.cc
++++ b/source/blender/python/generic/py_capi_utils.cc
+@@ -39,6 +39,11 @@
+ #  include "BLI_math_base.h" /* isfinite() */
+ #endif
+ 
++#if PY_VERSION_HEX <= 0x030c0000 /* <=3.12 */
++#  define PyLong_AsInt _PyLong_AsInt
++#  define PyUnicode_CompareWithASCIIString _PyUnicode_EqualToASCIIString
++#endif
++
+ /* -------------------------------------------------------------------- */
+ /** \name Fast Python to C Array Conversion for Primitive Types
+  * \{ */
+@@ -874,10 +879,12 @@ static void pyc_exception_buffer_handle_system_exit()
+   if (!PyErr_ExceptionMatches(PyExc_SystemExit)) {
+     return;
+   }
+-  /* Inspecting, follow Python's logic in #_Py_HandleSystemExit & treat as a 
regular exception. */
++/* Inspecting, follow Python's logic in #_Py_HandleSystemExit & treat as a 
regular exception. */
++#  if 0 /* FIXME: */
+   if (_Py_GetConfig()->inspect) {
+     return;
+   }
++#  endif
+ 
+   /* NOTE(@ideasman42): A `SystemExit` exception will exit immediately 
(unless inspecting).
+    * So print the error and exit now. Without this #PyErr_Display shows the 
error stack-trace
+@@ -1424,11 +1431,6 @@ int PyC_FlagSet_ToBitfield(const PyC_FlagSet *items,
+   /* set of enum items, concatenate all values with OR */
+   int ret, flag = 0;
+ 
+-  /* set looping */
+-  Py_ssize_t pos = 0;
+-  Py_ssize_t hash = 0;
+-  PyObject *key;
+-
+   if (!PySet_Check(value)) {
+     PyErr_Format(PyExc_TypeError,
+                  "%.200s expected a set, not %.200s",
+@@ -1439,22 +1441,32 @@ int PyC_FlagSet_ToBitfield(const PyC_FlagSet *items,
+ 
+   *r_value = 0;
+ 
+-  while (_PySet_NextEntry(value, &pos, &key, &hash)) {
+-    const char *param = PyUnicode_AsUTF8(key);
++  if (PySet_GET_SIZE(value) > 0) {
++    PyObject *it = PyObject_GetIter(value);
++    PyObject *key;
++    while ((key = PyIter_Next(it))) {
++      /* Borrow from the set. */
++      Py_DECREF(key);
+ 
+-    if (param == nullptr) {
+-      PyErr_Format(PyExc_TypeError,
+-                   "%.200s set must contain strings, not %.200s",
+-                   error_prefix,
+-                   Py_TYPE(key)->tp_name);
++      const char *param = PyUnicode_AsUTF8(key);
++      if (param == nullptr) {
++        PyErr_Format(PyExc_TypeError,
++                     "%.200s set must contain strings, not %.200s",
++                     error_prefix,
++                     Py_TYPE(key)->tp_name);
++        break;
++      }
++
++      if (PyC_FlagSet_ValueFromID(items, param, &ret, error_prefix) < 0) {
++        break;
++      }
++
++      flag |= ret;
++    }
++    Py_DECREF(it);
++    if (key != nullptr) {
+       return -1;
+     }
+-
+-    if (PyC_FlagSet_ValueFromID(items, param, &ret, error_prefix) < 0) {
+-      return -1;
+-    }
+-
+-    flag |= ret;
+   }
+ 
+   *r_value = flag;
+@@ -1724,7 +1736,7 @@ static ulong pyc_Long_AsUnsignedLong(PyObject *value)
+ 
+ int PyC_Long_AsBool(PyObject *value)
+ {
+-  const int test = _PyLong_AsInt(value);
++  const int test = PyLong_AsInt(value);
+   if (UNLIKELY(test == -1 && PyErr_Occurred())) {
+     return -1;
+   }
+@@ -1737,7 +1749,7 @@ int PyC_Long_AsBool(PyObject *value)
+ 
+ int8_t PyC_Long_AsI8(PyObject *value)
+ {
+-  const int test = _PyLong_AsInt(value);
++  const int test = PyLong_AsInt(value);
+   if (UNLIKELY(test == -1 && PyErr_Occurred())) {
+     return -1;
+   }
+@@ -1750,7 +1762,7 @@ int8_t PyC_Long_AsI8(PyObject *value)
+ 
+ int16_t PyC_Long_AsI16(PyObject *value)
+ {
+-  const int test = _PyLong_AsInt(value);
++  const int test = PyLong_AsInt(value);
+   if (UNLIKELY(test == -1 && PyErr_Occurred())) {
+     return -1;
+   }
+diff --git a/source/blender/python/generic/py_capi_utils.hh 
b/source/blender/python/generic/py_capi_utils.hh
+index 4a641f78471..81740e0d0ad 100644
+--- a/source/blender/python/generic/py_capi_utils.hh
++++ b/source/blender/python/generic/py_capi_utils.hh
+@@ -339,7 +339,11 @@ uint64_t PyC_Long_AsU64(PyObject *value);
+ /* inline so type signatures match as expected */
+ Py_LOCAL_INLINE(int32_t) PyC_Long_AsI32(PyObject *value)
+ {
++#if PY_VERSION_HEX <= 0x030c0000 /* <=3.12 */
+   return (int32_t)_PyLong_AsInt(value);
++#else
++  return (int32_t)PyLong_AsInt(value);
++#endif
+ }
+ Py_LOCAL_INLINE(int64_t) PyC_Long_AsI64(PyObject *value)
+ {
+diff --git a/source/blender/python/generic/python_compat.hh 
b/source/blender/python/generic/python_compat.hh
+index f18d0fb59b3..e2799aeeb46 100644
+--- a/source/blender/python/generic/python_compat.hh
++++ b/source/blender/python/generic/python_compat.hh
+@@ -9,9 +9,17 @@
+ 
+ #pragma once
+ 
++/* Removes `intialized` member from Python 3.13+. */
++#if PY_VERSION_HEX >= 0x030d0000
++#  define PY_ARG_PARSER_HEAD_COMPAT()
++#elif PY_VERSION_HEX >= 0x030c0000
+ /* Add `intialized` member for Python 3.12+. */
+-#if PY_VERSION_HEX >= 0x030c0000
+ #  define PY_ARG_PARSER_HEAD_COMPAT() 0,
+ #else
+ #  define PY_ARG_PARSER_HEAD_COMPAT()
+ #endif
++
++/* Python 3.13 made some changes, use the "new" names. */
++#if PY_VERSION_HEX < 0x030d0000
++#  define PyObject_GetOptionalAttr _PyObject_LookupAttr
++#endif
+diff --git a/source/blender/python/gpu/gpu_py_framebuffer.cc 
b/source/blender/python/gpu/gpu_py_framebuffer.cc
+index 899ad21f770..9bef53654df 100644
+--- a/source/blender/python/gpu/gpu_py_framebuffer.cc
++++ b/source/blender/python/gpu/gpu_py_framebuffer.cc
+@@ -286,14 +286,14 @@ static bool pygpu_framebuffer_new_parse_arg(PyObject *o, 
GPUAttachment *r_attach
+         return false;
+       }
+ 
+-      if (c_texture && _PyUnicode_EqualToASCIIString(key, c_texture)) {
++      if (c_texture && PyUnicode_CompareWithASCIIString(key, c_texture)) {
+         /* Compare only once. */
+         c_texture = nullptr;
+         if (!bpygpu_ParseTexture(value, &tmp_attach.tex)) {
+           return false;
+         }
+       }
+-      else if (c_layer && _PyUnicode_EqualToASCIIString(key, c_layer)) {
++      else if (c_layer && PyUnicode_CompareWithASCIIString(key, c_layer)) {
+         /* Compare only once. */
+         c_layer = nullptr;
+         tmp_attach.layer = PyLong_AsLong(value);
+@@ -301,7 +301,7 @@ static bool pygpu_framebuffer_new_parse_arg(PyObject *o, 
GPUAttachment *r_attach
+           return false;
+         }
+       }
+-      else if (c_mip && _PyUnicode_EqualToASCIIString(key, c_mip)) {
++      else if (c_mip && PyUnicode_CompareWithASCIIString(key, c_mip)) {
+         /* Compare only once. */
+         c_mip = nullptr;
+         tmp_attach.mip = PyLong_AsLong(value);
+diff --git a/source/blender/python/intern/bpy.cc 
b/source/blender/python/intern/bpy.cc
+index 7cdd00fc7a3..42ea76e40ac 100644
+--- a/source/blender/python/intern/bpy.cc
++++ b/source/blender/python/intern/bpy.cc
+@@ -610,38 +610,40 @@ PyDoc_STRVAR(
+     "   :rtype: dict\n");
+ static PyObject *bpy_wm_capabilities(PyObject *self)
+ {
+-  static _Py_Identifier PyId_capabilities = {"_wm_capabilities_", -1};
+-
++  PyObject *py_id_capabilities = PyUnicode_FromString("_wm_capabilities_");
+   PyObject *result = nullptr;
+-  switch (_PyObject_LookupAttrId(self, &PyId_capabilities, &result)) {
+-    case 1:
+-      return result;
+-    case 0:
+-      break;
+-    default:
+-      /* Unlikely, but there may be an error, forward it. */
+-      return nullptr;
+-  }
++  switch (PyObject_GetOptionalAttr(self, py_id_capabilities, &result)) {
++    case 1: {
++      result = PyDict_New();
+ 
+-  result = PyDict_New();
+-
+-  const eWM_CapabilitiesFlag flag = WM_capabilities_flag();
++      const eWM_CapabilitiesFlag flag = WM_capabilities_flag();
+ 
+ #define SetFlagItem(x) \
+   PyDict_SetItemString(result, STRINGIFY(x), 
PyBool_FromLong((WM_CAPABILITY_##x) & flag));
+ 
+-  SetFlagItem(CURSOR_WARP);
+-  SetFlagItem(WINDOW_POSITION);
+-  SetFlagItem(PRIMARY_CLIPBOARD);
+-  SetFlagItem(GPU_FRONT_BUFFER_READ);
+-  SetFlagItem(CLIPBOARD_IMAGES);
+-  SetFlagItem(DESKTOP_SAMPLE);
+-  SetFlagItem(INPUT_IME);
+-  SetFlagItem(TRACKPAD_PHYSICAL_DIRECTION);
++      SetFlagItem(CURSOR_WARP);
++      SetFlagItem(WINDOW_POSITION);
++      SetFlagItem(PRIMARY_CLIPBOARD);
++      SetFlagItem(GPU_FRONT_BUFFER_READ);
++      SetFlagItem(CLIPBOARD_IMAGES);
++      SetFlagItem(DESKTOP_SAMPLE);
++      SetFlagItem(INPUT_IME);
++      SetFlagItem(TRACKPAD_PHYSICAL_DIRECTION);
+ 
+ #undef SetFlagItem
++      PyObject_SetAttr(self, py_id_capabilities, result);
++      break;
++    }
++    case 0:
++      BLI_assert(result != nullptr);
++      break;
++    default:
++      /* Unlikely, but there may be an error, forward it. */
++      BLI_assert(result == nullptr);
++      break;
++  }
+ 
+-  _PyObject_SetAttrId(self, &PyId_capabilities, result);
++  Py_DECREF(py_id_capabilities);
+   return result;
+ }
+ 
+diff --git a/source/blender/python/intern/bpy_driver.cc 
b/source/blender/python/intern/bpy_driver.cc
+index b32bfbc2a56..e589f0992e1 100644
+--- a/source/blender/python/intern/bpy_driver.cc
++++ b/source/blender/python/intern/bpy_driver.cc
+@@ -43,6 +43,13 @@
+ #  include <opcode.h>
+ #endif
+ 
++#if PY_VERSION_HEX >= 0x030d0000 /* >=3.13 */
++/* WARNING(@ideasman42): Using `Py_BUILD_CORE` is a last resort,
++ * the alternative would be not to inspect OP-CODES at all. */
++#  define Py_BUILD_CORE
++#  include <internal/pycore_code.h>
++#endif
++
+ PyObject *bpy_pydriver_Dict = nullptr;
+ 
+ #ifdef USE_BYTECODE_WHITELIST
+@@ -375,7 +382,35 @@ static bool is_opcode_secure(const int opcode)
+     OK_OP(LOAD_CONST) /* Ok because constants are accepted. */
+     OK_OP(LOAD_NAME)  /* Ok, because `PyCodeObject.names` is checked. */
+     OK_OP(CALL)       /* Ok, because we check its "name" before calling. */
+-    OK_OP(KW_NAMES)   /* Ok, because it's used for calling functions with 
keyword arguments. */
++#  if PY_VERSION_HEX >= 0x030d0000
++    OK_OP(CALL_KW) /* Ok, because it's used for calling functions with 
keyword arguments. */
++
++    OK_OP(CALL_FUNCTION_EX);
++
++    /* OK because the names are checked. */
++    OK_OP(CALL_ALLOC_AND_ENTER_INIT)
++    OK_OP(CALL_BOUND_METHOD_EXACT_ARGS)
++    OK_OP(CALL_BOUND_METHOD_GENERAL)
++    OK_OP(CALL_BUILTIN_CLASS)
++    OK_OP(CALL_BUILTIN_FAST)
++    OK_OP(CALL_BUILTIN_FAST_WITH_KEYWORDS)
++    OK_OP(CALL_BUILTIN_O)
++    OK_OP(CALL_ISINSTANCE)
++    OK_OP(CALL_LEN)
++    OK_OP(CALL_LIST_APPEND)
++    OK_OP(CALL_METHOD_DESCRIPTOR_FAST)
++    OK_OP(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS)
++    OK_OP(CALL_METHOD_DESCRIPTOR_NOARGS)
++    OK_OP(CALL_METHOD_DESCRIPTOR_O)
++    OK_OP(CALL_NON_PY_GENERAL)
++    OK_OP(CALL_PY_EXACT_ARGS)
++    OK_OP(CALL_PY_GENERAL)
++    OK_OP(CALL_STR_1)
++    OK_OP(CALL_TUPLE_1)
++    OK_OP(CALL_TYPE_1)
++#  else
++    OK_OP(KW_NAMES) /* Ok, because it's used for calling functions with 
keyword arguments. */
++#  endif
+ 
+ #  if PY_VERSION_HEX < 0x030c0000
+     OK_OP(PRECALL) /* Ok, because it's used for calling. */
+diff --git a/source/blender/python/intern/bpy_library_write.cc 
b/source/blender/python/intern/bpy_library_write.cc
+index d1c0b32ac07..59bf476427f 100644
+--- a/source/blender/python/intern/bpy_library_write.cc
++++ b/source/blender/python/intern/bpy_library_write.cc
+@@ -136,20 +136,25 @@ static PyObject *bpy_lib_write(BPy_PropertyRNA *self, 
PyObject *args, PyObject *
+       PartialWriteContext::IDAddOperations::ADD_DEPENDENCIES |
+       (use_fake_user ? PartialWriteContext::IDAddOperations::SET_FAKE_USER : 
0))};
+ 
+-  Py_ssize_t pos, hash;
+-  PyObject *key;
+-  ID *id = nullptr;
+-
+-  pos = hash = 0;
+-  while (_PySet_NextEntry(datablocks, &pos, &key, &hash)) {
+-    if (!pyrna_id_FromPyObject(key, &id)) {
+-      PyErr_Format(PyExc_TypeError, "Expected an ID type, not %.200s", 
Py_TYPE(key)->tp_name);
+-      return nullptr;
+-    }
+-    else {
++  if (PySet_GET_SIZE(datablocks) > 0) {
++    PyObject *it = PyObject_GetIter(datablocks);
++    PyObject *key;
++    while ((key = PyIter_Next(it))) {
++      /* Borrow from the set. */
++      Py_DECREF(key);
++      ID *id;
++      if (!pyrna_id_FromPyObject(key, &id)) {
++        PyErr_Format(PyExc_TypeError, "Expected an ID type, not %.200s", 
Py_TYPE(key)->tp_name);
++        break;
++      }
+       partial_write_ctx.id_add(id, add_options, nullptr);
+     }
++    Py_DECREF(it);
++    if (key) {
++      return nullptr;
++    }
+   }
++
+   BLI_assert(partial_write_ctx.is_valid());
+ 
+   /* write blend */
+diff --git a/source/blender/python/intern/bpy_rna.cc 
b/source/blender/python/intern/bpy_rna.cc
+index eb365bf0238..a9cb115f57e 100644
+--- a/source/blender/python/intern/bpy_rna.cc
++++ b/source/blender/python/intern/bpy_rna.cc
+@@ -8639,7 +8639,7 @@ static int bpy_class_validate_recursive(PointerRNA 
*dummy_ptr,
+       continue;
+     }
+ 
+-    /* TODO(@ideasman42): Use Python3.7x _PyObject_LookupAttr(), also in the 
macro below. */
++    /* TODO(@ideasman42): Use #PyObject_GetOptionalAttr(), also in the macro 
below. */
+     identifier = RNA_property_identifier(prop);
+     item = PyObject_GetAttrString(py_class, identifier);
+ 
+@@ -9263,7 +9263,7 @@ static PyObject *pyrna_register_class(PyObject * 
/*self*/, PyObject *py_class)
+ 
+   /* Call classed register method.
+    * Note that zero falls through, no attribute, no error. */
+-  switch (_PyObject_LookupAttr(py_class, bpy_intern_str_register, 
&py_cls_meth)) {
++  switch (PyObject_GetOptionalAttr(py_class, bpy_intern_str_register, 
&py_cls_meth)) {
+     case 1: {
+       PyObject *ret = PyObject_CallObject(py_cls_meth, nullptr);
+       Py_DECREF(py_cls_meth);
+@@ -9378,7 +9378,7 @@ static PyObject *pyrna_unregister_class(PyObject * 
/*self*/, PyObject *py_class)
+ 
+   /* Call classed unregister method.
+    * Note that zero falls through, no attribute, no error. */
+-  switch (_PyObject_LookupAttr(py_class, bpy_intern_str_unregister, 
&py_cls_meth)) {
++  switch (PyObject_GetOptionalAttr(py_class, bpy_intern_str_unregister, 
&py_cls_meth)) {
+     case 1: {
+       PyObject *ret = PyObject_CallObject(py_cls_meth, nullptr);
+       Py_DECREF(py_cls_meth);

diff --git a/media-gfx/blender/metadata.xml b/media-gfx/blender/metadata.xml
index 09310cae2fcc..ad273f3c5990 100644
--- a/media-gfx/blender/metadata.xml
+++ b/media-gfx/blender/metadata.xml
@@ -44,9 +44,6 @@
                        This makes it so that the user doesn't have to wait for 
the kernels to compile when they are used for the first time in Blender.
                        If this option is not on, they will be built as needed 
at runtime.
                </flag>
-               <flag name="dds">
-                       Adds DDS textures support to Blender.
-               </flag>
                <flag name="embree">
                        Use embree to accelerate certain areas of the Cycles 
render engine.
                </flag>

Reply via email to