commit: 24950a7e857e20f61f228d297abb0d70e292c23b
Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 1 06:18:43 2025 +0000
Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Tue Jul 1 06:19:02 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=24950a7e
sci-ml/pytorch: add 2.7.1
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
sci-ml/pytorch/Manifest | 1 +
sci-ml/pytorch/pytorch-2.7.1.ebuild | 68 +++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)
diff --git a/sci-ml/pytorch/Manifest b/sci-ml/pytorch/Manifest
index 72030b7da77c..fa8a968b13ff 100644
--- a/sci-ml/pytorch/Manifest
+++ b/sci-ml/pytorch/Manifest
@@ -2,3 +2,4 @@ DIST pytorch-2.4.1.tar.gz 115029469 BLAKE2B
c2909ff27d527bc57cba56b780d3b8cd07a0
DIST pytorch-2.5.1.tar.gz 116091366 BLAKE2B
7838b17562b94ffc7d798031348689db607dd5eae2a3c35be365972e2b52a2c1b12067068d5aca5ab00cf0977d9c2c3c9ae5337d69534c864c732e6256cbeef6
SHA512
a913a466324a65fa3d79c5e9ad4d605fc7976f0134fda2f81aaa3cea29d56926604999b8a238759646d211e63b47bbb446cdffa86ca8defd8159f11e30301289
DIST pytorch-2.6.0.tar.gz 119594438 BLAKE2B
3152eb341cf42295e147e59625beb9c06608aa4b78f9618c1c0024b10c1c767715d07fe8c4be52d029ac47f808cd0d5e65c9530ec90d951a64b993083b4067ad
SHA512
a70da80ff09d226085e18228132cf6bb236ad8cc47eed52375d0d2a615f09dd33849da947270b5670c184eab60cb8e2adf11d801babfbda7aa621400501d07b0
DIST pytorch-2.7.0.tar.gz 50197290 BLAKE2B
2a317d1e9b0d8876f1593382246cd9f786eff3c1b8602353c5e0010dc8414720c5de61886361843a0c33268830c784963a89b410b361e1b67636e652f6a6a2eb
SHA512
63eb0363ea68d23567f5524ee8b51756d9302bbe1cbefa367335ab5ebe652523dba75fa417ea3e7eedfc67aa4bef1434c8b7e3dfde2152061b91b6e489763a55
+DIST pytorch-2.7.1.tar.gz 50203605 BLAKE2B
3f4b2643d86fe9ff30b2f335353dfe6a8e222bcc12143bc5d09268fb37bfd42f9451620e6e0db225c3c3e7930c999115fdd2ed62b7eae93b0d5e233270c7c760
SHA512
a9fc2252af9031c2cd46dde558c491aea8bc322fb80157a7760f300a44b759d4bfe866f030fbb974b80493057cfff4dd512498f99a100ed6d05bf620258ed37e
diff --git a/sci-ml/pytorch/pytorch-2.7.1.ebuild
b/sci-ml/pytorch/pytorch-2.7.1.ebuild
new file mode 100644
index 000000000000..c6ade562815d
--- /dev/null
+++ b/sci-ml/pytorch/pytorch-2.7.1.ebuild
@@ -0,0 +1,68 @@
+# 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}]
+ ')
+"
+
+src_prepare() {
+ eapply "${FILESDIR}"/${PN}-2.6.0-dontbuildagain.patch
+
+ # Set build dir for pytorch's setup
+ sed -i \
+ -e "/BUILD_DIR/s|build|/var/lib/caffe2/|" \
+ tools/setup_helpers/env.py \
+ || die
+ # Drop legacy from pyproject.toml
+ sed -i \
+ -e "/build-backend/s|:__legacy__||" \
+ 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
+}