commit:     76edbaaed0b54c5fe7b8ad0b93cca3eefa909744
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 18 05:47:20 2025 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Tue Nov 18 05:47:32 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76edbaae

sci-ml/pytorch: add 2.9.1

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

 sci-ml/pytorch/Manifest             |  1 +
 sci-ml/pytorch/pytorch-2.9.1.ebuild | 73 +++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)

diff --git a/sci-ml/pytorch/Manifest b/sci-ml/pytorch/Manifest
index 396715e4aafe..8d4bd6c30108 100644
--- a/sci-ml/pytorch/Manifest
+++ b/sci-ml/pytorch/Manifest
@@ -1,2 +1,3 @@
 DIST pytorch-2.8.0.tar.gz 56565754 BLAKE2B 
a8f07513b92f9293f8322508f9fc73a462f89fe51cb1f280af371cee19cbe7e2bf900ba2b3c43fd08ea415566db441a6d6310d77f18477e957641be311a361a5
 SHA512 
448e9dad4aa10f1793d35e6ffe9f0f69b7719d41e6eccceb687a8d0c148e22d03e4f76170a05308ef9323a7aea41aa74605077ae1d68c6d949f13b3340ebf310
 DIST pytorch-2.9.0.tar.gz 55750268 BLAKE2B 
943459ec60a4e1f5e36766defc7018fbf9722fb1564b723c2a7ebcb2a5d8b1735f0b1542dc67a77f788af3e2454ea6261dbdee5beb2bcfa4af2e58ca566edc93
 SHA512 
2ecdc0eac39ecee68b0f4c98e498424cde00c45bbeeff576c8778046f97119cd02885498b072352dd3cdd9aecd02baf61cdc5554bce8d757b30c673053a0cc80
+DIST pytorch-2.9.1.tar.gz 55764697 BLAKE2B 
b22e154034f8a25aa3ef949eb6b0456777e11fe5f97de56c6112d93a2e154db425e97848911af458d179f03d7154956f53b715c7b9d7e7f074e0baceac35dad8
 SHA512 
d7098408d44e0fee9ded4afd6622df6f08757bf02eee878ae25b62a275f82eb16f96a07027c670c6ffdd431c8714c569249bd8518ac8828a504e99908b8c38b1

diff --git a/sci-ml/pytorch/pytorch-2.9.1.ebuild 
b/sci-ml/pytorch/pytorch-2.9.1.ebuild
new file mode 100644
index 000000000000..18185e48f57a
--- /dev/null
+++ b/sci-ml/pytorch/pytorch-2.9.1.ebuild
@@ -0,0 +1,73 @@
+# Copyright 2022-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{11..13} )
+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.7.1-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
+
+       # Get object file from caffe2
+       cp "${ESYSROOT}"/var/lib/caffe2/functorch.so functorch/functorch.so || 
die
+
+       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