From a60f12dfc4968dca1ae3530f85bda74bc298cd8d Mon Sep 17 00:00:00 2001 From: Alfredo Tupone Date: Thu, 21 May 2026 09:47:53 +0200 Subject: [PATCH] sci-ml/pytorch: add 2.12.0 Signed-off-by: Alfredo Tupone --- sci-ml/pytorch/Manifest | 1 + sci-ml/pytorch/pytorch-2.12.0.ebuild | 70 ++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 sci-ml/pytorch/pytorch-2.12.0.ebuild diff --git a/sci-ml/pytorch/Manifest b/sci-ml/pytorch/Manifest index 243d605bb65bb..e11be7b5ef395 100644 --- a/sci-ml/pytorch/Manifest +++ b/sci-ml/pytorch/Manifest @@ -1 +1,2 @@ DIST pytorch-2.11.0.tar.gz 63504636 BLAKE2B d7227bd2d5475acf696bb48a3ca8cd8b7b6cd75fb99e64ebc71434e23817f94dea5164f48a176dcad1acd12186c33b02452582c1b41d6265b89cf54b29630670 SHA512 a5b27efdbce0506b49808e9dc5fbf1a56a22b1651b60236570823e1fe2c7395a0de9d3d7a01a568a201d593c52e7aa402e5d7645a54cb5932d5866e374ebf945 +DIST pytorch-2.12.0.tar.gz 64740318 BLAKE2B e5e46a93422454da420563d0a8057c87d1ed4b27e0bd9b3b30e46b5e40cfbb489072144ac00267af2f085432d55e12adf750daf15ea165a1252449b00dca1ff9 SHA512 f5ab0f6933d88271f772b416f8c9b3b0d3e1ffaf8d00838b455206266b40d7c805e34003d84b01cddc7f1ad917dd72d6f79a05063b0962cbf223d9042cff3206 diff --git a/sci-ml/pytorch/pytorch-2.12.0.ebuild b/sci-ml/pytorch/pytorch-2.12.0.ebuild new file mode 100644 index 0000000000000..59daa303387f4 --- /dev/null +++ b/sci-ml/pytorch/pytorch-2.12.0.ebuild @@ -0,0 +1,70 @@ +# Copyright 2022-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{11..14} ) +DISTUTILS_SINGLE_IMPL=1 +DISTUTILS_EXT=1 +inherit distutils-r1 prefix + +DESCRIPTION="Tensors and Dynamic neural networks in Python" +HOMEPAGE="https://pytorch.org/" +SRC_URI="https://github.com/pytorch/${PN}/archive/refs/tags/v${PV}.tar.gz + -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~arm64" +RESTRICT="test" + +REQUIRED_USE=${PYTHON_REQUIRED_USE} +RDEPEND=" + ${PYTHON_DEPS} + ~sci-ml/caffe2-${PV}[${PYTHON_SINGLE_USEDEP}] + $(python_gen_cond_dep ' + dev-python/sympy[${PYTHON_USEDEP}] + dev-python/typing-extensions[${PYTHON_USEDEP}] + ') +" +DEPEND="${RDEPEND} + $(python_gen_cond_dep ' + dev-python/pyyaml[${PYTHON_USEDEP}] + ') +" + +PATCHES=( + "${FILESDIR}"/${PN}-2.9.0-dontbuildagain.patch + "${FILESDIR}"/${PN}-2.10.0-cpp-extension-multilib.patch +) + +src_prepare() { + # Replace placeholders added by cpp-extension.patch + sed -e "s|%LIB_DIR%|$(get_libdir)|g" \ + -i torch/utils/cpp_extension.py || die + + # Set build dir for pytorch's setup + sed -e "/BUILD_DIR/s|build|/var/lib/caffe2/|" \ + -i tools/setup_helpers/env.py || die + + # Drop legacy from pyproject.toml + sed -e "/build-backend/s|:__legacy__||" \ + -i pyproject.toml || die + + distutils-r1_src_prepare + + hprefixify tools/setup_helpers/env.py +} + +python_compile() { + PYTORCH_BUILD_VERSION=${PV} \ + PYTORCH_BUILD_NUMBER=0 \ + USE_SYSTEM_LIBS=ON \ + CMAKE_BUILD_DIR="${BUILD_DIR}" \ + distutils-r1_python_compile develop sdist +} + +python_install() { + USE_SYSTEM_LIBS=ON distutils-r1_python_install +}