summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Tupone <tupone@gentoo.org>2023-02-14 20:31:25 +0100
committerAlfredo Tupone <tupone@gentoo.org>2023-02-14 20:31:40 +0100
commit3c8165f6ff751f984855d95e5f66d2d66b65a04f (patch)
treea79e82e9542091c6298aaad95074808edf4827e4 /sci-libs
parentsci-libs/caffe2: add 1.13.0 (diff)
downloadgentoo-3c8165f6ff751f984855d95e5f66d2d66b65a04f.tar.gz
gentoo-3c8165f6ff751f984855d95e5f66d2d66b65a04f.tar.bz2
gentoo-3c8165f6ff751f984855d95e5f66d2d66b65a04f.zip
sci-libs/pytorch: add 1.13.0
Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
Diffstat (limited to 'sci-libs')
-rw-r--r--sci-libs/pytorch/Manifest1
-rw-r--r--sci-libs/pytorch/files/pytorch-1.13.0-setup.patch11
-rw-r--r--sci-libs/pytorch/pytorch-1.13.0.ebuild63
3 files changed, 75 insertions, 0 deletions
diff --git a/sci-libs/pytorch/Manifest b/sci-libs/pytorch/Manifest
index adfe026eaff0..fba79e4a9a24 100644
--- a/sci-libs/pytorch/Manifest
+++ b/sci-libs/pytorch/Manifest
@@ -1,2 +1,3 @@
DIST pytorch-1.12.0.tar.gz 106286765 BLAKE2B ff9bafedb35f859f7dccb9b606299cf9c345bdaa0deb87ecfe0c0c30c3c828414d989e1d9a243d9b7cd3f376d56a2f81c241ca2e3c9a8a2b30cddcdeddd3a5c7 SHA512 c9c748a2e0047daaaf199a1ba3198d2d1aee47f664170a9b34ccacd3deeb95f2070e4035eeb900012ef48dc62cf6fb6806f1a1dfe22de8c94892963076e593b7
DIST pytorch-1.12.1.tar.gz 106311625 BLAKE2B e8ca19d0e1987449c33ad4c36722a3a467f7f8a9f90be2a7f2de643cbd665038f6802b5ff1f1d3da09b6253d8f29e11549a24295de013d97f73affe538c84c99 SHA512 afeb551904ebd9b5901ae623a98eadbb3045115247cedf8006a940742cfad04e5ce24cfaf363336a9ed88d7ce6a4ac53dbb6a5c690aef6efdf20477c3a22c7ca
+DIST pytorch-1.13.0.tar.gz 108276317 BLAKE2B 8149775dea06d8e4027b741c828169d33f768a96aef58cd2f86daa3bbad5bf36143454e26b683a992aca34e7fb52e6483c46168b698db48ff6978c9605d7a3d2 SHA512 5a0e8c589bdf552ccf682511a8860c754ab6f5844f51e568c5034793f787b97707af4340b338b9b8606dd27a6ced6ef50091f0cc514458b3021a2220409d7f20
diff --git a/sci-libs/pytorch/files/pytorch-1.13.0-setup.patch b/sci-libs/pytorch/files/pytorch-1.13.0-setup.patch
new file mode 100644
index 000000000000..bc5721e5b932
--- /dev/null
+++ b/sci-libs/pytorch/files/pytorch-1.13.0-setup.patch
@@ -0,0 +1,11 @@
+--- a/setup.py 2023-02-14 19:34:56.327571750 +0100
++++ b/setup.py 2023-02-14 19:35:31.073020464 +0100
+@@ -234,6 +234,8 @@
+ import time
+ import sysconfig
+
++sys.path[:0] = os.getcwd()
++
+ from tools.build_pytorch_libs import build_caffe2
+ from tools.setup_helpers.env import (IS_WINDOWS, IS_DARWIN, IS_LINUX,
+ build_type)
diff --git a/sci-libs/pytorch/pytorch-1.13.0.ebuild b/sci-libs/pytorch/pytorch-1.13.0.ebuild
new file mode 100644
index 000000000000..7cde7f7262bb
--- /dev/null
+++ b/sci-libs/pytorch/pytorch-1.13.0.ebuild
@@ -0,0 +1,63 @@
+# Copyright 2022-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{9,10} )
+DISTUTILS_SINGLE_IMPL=1
+inherit distutils-r1
+
+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}]
+ $(python_gen_cond_dep '
+ dev-python/typing-extensions[${PYTHON_USEDEP}]
+ ')
+"
+DEPEND="${RDEPEND}
+ $(python_gen_cond_dep '
+ dev-python/pyyaml[${PYTHON_USEDEP}]
+ ')
+"
+
+src_prepare() {
+ eapply \
+ "${FILESDIR}"/0002-Don-t-build-libtorch-again-for-PyTorch-1.7.1.patch \
+ "${FILESDIR}"/pytorch-1.9.0-Change-library-directory-according-to-CMake-build.patch \
+ "${FILESDIR}"/${PN}-1.6.0-global-dlopen.patch \
+ "${FILESDIR}"/pytorch-1.7.1-torch_shm_manager.patch \
+ "${FILESDIR}"/${P}-setup.patch \
+ "${FILESDIR}"/pytorch-1.12.0-CVE-2022-45907.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
+}
+
+src_compile() {
+ PYTORCH_BUILD_VERSION=${PV} \
+ PYTORCH_BUILD_NUMBER=0 \
+ USE_SYSTEM_LIBS=ON \
+ CMAKE_BUILD_DIR="${BUILD_DIR}" \
+ BUILD_DIR= \
+ distutils-r1_src_compile
+}
+
+src_install() {
+ USE_SYSTEM_LIBS=ON distutils-r1_src_install
+}