diff --git a/sci-ml/pytorch/Manifest b/sci-ml/pytorch/Manifest index c58f34c493ac7..0950d1f4afed6 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.11.0.tar.gz 63504636 BLAKE2B d7227bd2d5475acf696bb48a3ca8cd8b7b6cd75fb99e64ebc71434e23817f94dea5164f48a176dcad1acd12186c33b02452582c1b41d6265b89cf54b29630670 SHA512 a5b27efdbce0506b49808e9dc5fbf1a56a22b1651b60236570823e1fe2c7395a0de9d3d7a01a568a201d593c52e7aa402e5d7645a54cb5932d5866e374ebf945 DIST pytorch-2.9.1.tar.gz 55764697 BLAKE2B b22e154034f8a25aa3ef949eb6b0456777e11fe5f97de56c6112d93a2e154db425e97848911af458d179f03d7154956f53b715c7b9d7e7f074e0baceac35dad8 SHA512 d7098408d44e0fee9ded4afd6622df6f08757bf02eee878ae25b62a275f82eb16f96a07027c670c6ffdd431c8714c569249bd8518ac8828a504e99908b8c38b1 diff --git a/sci-ml/pytorch/pytorch-2.11.0.ebuild b/sci-ml/pytorch/pytorch-2.11.0.ebuild new file mode 100644 index 0000000000000..59daa303387f4 --- /dev/null +++ b/sci-ml/pytorch/pytorch-2.11.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 +}