commit:     7593480d708149b9086bf0b2396c59401b6e151b
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 27 07:18:24 2026 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Tue Jan 27 07:18:32 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7593480d

sci-ml/pytorch: add 2.10.0

Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 sci-ml/pytorch/Manifest                            |  1 +
 .../pytorch-2.10.0-cpp-extension-multilib.patch    | 16 +++++
 sci-ml/pytorch/pytorch-2.10.0.ebuild               | 70 ++++++++++++++++++++++
 3 files changed, 87 insertions(+)

diff --git a/sci-ml/pytorch/Manifest b/sci-ml/pytorch/Manifest
index bbc6a39927e8..a7a17fa2ee6f 100644
--- a/sci-ml/pytorch/Manifest
+++ b/sci-ml/pytorch/Manifest
@@ -1,2 +1,3 @@
+DIST pytorch-2.10.0.tar.gz 62555251 BLAKE2B 
6b48b4d3d3802a82d37231c472032f8c9390bdbfe9e810ff811f5521737b46794db51e87f7aad3928be917923ae8ac9c619b14d8d0cfacfc115dffb38347bd43
 SHA512 
929b1be42954f22e2091e0696d6175c8f30752925ce0bbe3a60a9393aff1f0afb228fa5efaf1ce26e78cd9e99294d150109e9ba9cb3243c90e9ec06cc082f74d
 DIST pytorch-2.8.0.tar.gz 56565754 BLAKE2B 
a8f07513b92f9293f8322508f9fc73a462f89fe51cb1f280af371cee19cbe7e2bf900ba2b3c43fd08ea415566db441a6d6310d77f18477e957641be311a361a5
 SHA512 
448e9dad4aa10f1793d35e6ffe9f0f69b7719d41e6eccceb687a8d0c148e22d03e4f76170a05308ef9323a7aea41aa74605077ae1d68c6d949f13b3340ebf310
 DIST pytorch-2.9.1.tar.gz 55764697 BLAKE2B 
b22e154034f8a25aa3ef949eb6b0456777e11fe5f97de56c6112d93a2e154db425e97848911af458d179f03d7154956f53b715c7b9d7e7f074e0baceac35dad8
 SHA512 
d7098408d44e0fee9ded4afd6622df6f08757bf02eee878ae25b62a275f82eb16f96a07027c670c6ffdd431c8714c569249bd8518ac8828a504e99908b8c38b1

diff --git a/sci-ml/pytorch/files/pytorch-2.10.0-cpp-extension-multilib.patch 
b/sci-ml/pytorch/files/pytorch-2.10.0-cpp-extension-multilib.patch
new file mode 100644
index 000000000000..68e39f988835
--- /dev/null
+++ b/sci-ml/pytorch/files/pytorch-2.10.0-cpp-extension-multilib.patch
@@ -0,0 +1,16 @@
+Fixes multilib (%LIB_DIR% should be replaced in ebuild)
+--- a/torch/utils/cpp_extension.py
++++ b/torch/utils/cpp_extension.py
+@@ -1478,10 +1477,10 @@ def library_paths(device_type: str = "cpu") -> 
list[str]:
+     paths = [TORCH_LIB_PATH]
+ 
+     if device_type == "cuda" and IS_HIP_EXTENSION:
+-        lib_dir = 'lib'
++        lib_dir = '%LIB_DIR%'
+         paths.append(_join_rocm_home(lib_dir))
+         if HIP_HOME is not None:
+-            paths.append(os.path.join(HIP_HOME, 'lib'))
++            paths.append(os.path.join(HIP_HOME, '%LIB_DIR%'))
+     elif device_type == "cuda":
+         if IS_WINDOWS:
+             lib_dir = os.path.join('lib', 'x64')

diff --git a/sci-ml/pytorch/pytorch-2.10.0.ebuild 
b/sci-ml/pytorch/pytorch-2.10.0.ebuild
new file mode 100644
index 000000000000..454774482e9b
--- /dev/null
+++ b/sci-ml/pytorch/pytorch-2.10.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}"/${P}-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
+}

Reply via email to