commit:     9972d58711ce03f5c6d3622755281206d3964eac
Author:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 27 21:26:52 2025 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Thu Feb 27 21:26:52 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9972d587

sci-libs/pytorch: add 2.6.0

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

 sci-libs/pytorch/Manifest                          |  1 +
 .../files/pytorch-2.6.0-dontbuildagain.patch       | 25 +++++++++
 sci-libs/pytorch/pytorch-2.6.0.ebuild              | 64 ++++++++++++++++++++++
 3 files changed, 90 insertions(+)

diff --git a/sci-libs/pytorch/Manifest b/sci-libs/pytorch/Manifest
index 2ca30109cb84..97a0008e4a0b 100644
--- a/sci-libs/pytorch/Manifest
+++ b/sci-libs/pytorch/Manifest
@@ -1,2 +1,3 @@
 DIST pytorch-2.4.1.tar.gz 115029469 BLAKE2B 
c2909ff27d527bc57cba56b780d3b8cd07a043ab045caa6c6b27857a16f9ad10aaab2116b26226b1e46ee08ffb44007965d914464418e4ae14ca48c3f3f383bb
 SHA512 
7e9b4485e242eaf0d648765c6621d73d95e7107b766646a098175436d1ab2e2b864badd0757a3bab6b7c318233f2120bad9ac07b39bb9e357897919580c87631
 DIST pytorch-2.5.1.tar.gz 116091366 BLAKE2B 
7838b17562b94ffc7d798031348689db607dd5eae2a3c35be365972e2b52a2c1b12067068d5aca5ab00cf0977d9c2c3c9ae5337d69534c864c732e6256cbeef6
 SHA512 
a913a466324a65fa3d79c5e9ad4d605fc7976f0134fda2f81aaa3cea29d56926604999b8a238759646d211e63b47bbb446cdffa86ca8defd8159f11e30301289
+DIST pytorch-2.6.0.tar.gz 119594438 BLAKE2B 
3152eb341cf42295e147e59625beb9c06608aa4b78f9618c1c0024b10c1c767715d07fe8c4be52d029ac47f808cd0d5e65c9530ec90d951a64b993083b4067ad
 SHA512 
a70da80ff09d226085e18228132cf6bb236ad8cc47eed52375d0d2a615f09dd33849da947270b5670c184eab60cb8e2adf11d801babfbda7aa621400501d07b0

diff --git a/sci-libs/pytorch/files/pytorch-2.6.0-dontbuildagain.patch 
b/sci-libs/pytorch/files/pytorch-2.6.0-dontbuildagain.patch
new file mode 100644
index 000000000000..75a386ce2969
--- /dev/null
+++ b/sci-libs/pytorch/files/pytorch-2.6.0-dontbuildagain.patch
@@ -0,0 +1,25 @@
+--- a/setup.py
++++ b/setup.py
+@@ -256,6 +256,7 @@
+ import setuptools.command.sdist
+ from setuptools import Extension, find_packages, setup
+ from setuptools.dist import Distribution
++sys.path[:0] = os.getcwd()
+ from tools.build_pytorch_libs import build_pytorch
+ from tools.generate_torch_version import get_torch_version
+ from tools.setup_helpers.cmake import CMake
+@@ -483,14 +483,6 @@
+     check_submodules()
+     check_pydep("yaml", "pyyaml")
+     build_python = not BUILD_LIBTORCH_WHL
+-    build_pytorch(
+-        version=version,
+-        cmake_python_library=cmake_python_library,
+-        build_python=build_python,
+-        rerun_cmake=RERUN_CMAKE,
+-        cmake_only=CMAKE_ONLY,
+-        cmake=cmake,
+-    )
+ 
+     if CMAKE_ONLY:
+         report(

diff --git a/sci-libs/pytorch/pytorch-2.6.0.ebuild 
b/sci-libs/pytorch/pytorch-2.6.0.ebuild
new file mode 100644
index 000000000000..9cb0e5814c84
--- /dev/null
+++ b/sci-libs/pytorch/pytorch-2.6.0.ebuild
@@ -0,0 +1,64 @@
+# 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_{10..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"
+RESTRICT="test"
+
+REQUIRED_USE=${PYTHON_REQUIRED_USE}
+RDEPEND="
+       ${PYTHON_DEPS}
+       ~sci-libs/caffe2-${PV}[${PYTHON_SINGLE_USEDEP}]
+       >=sci-libs/caffe2-2.5.1-r5
+       $(python_gen_cond_dep '
+               dev-python/typing-extensions[${PYTHON_USEDEP}]
+               dev-python/sympy[${PYTHON_USEDEP}]
+       ')
+"
+DEPEND="${RDEPEND}
+       $(python_gen_cond_dep '
+               dev-python/pyyaml[${PYTHON_USEDEP}]
+       ')
+"
+
+src_prepare() {
+       eapply "${FILESDIR}"/${P}-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
+       distutils-r1_src_prepare
+
+       # Get object file from caffe2
+       cp /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