* [gentoo-commits] repo/gentoo:master commit in: sci-libs/pytorch/files/, sci-libs/pytorch/
@ 2022-11-30 18:13 Alfredo Tupone
0 siblings, 0 replies; 7+ messages in thread
From: Alfredo Tupone @ 2022-11-30 18:13 UTC (permalink / raw
To: gentoo-commits
commit: 1b1b577bb33b34295e8cad2294c5486ee50200cf
Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 30 18:12:11 2022 +0000
Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Wed Nov 30 18:13:03 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b1b577b
sci-libs/pytorch: fix CVE-2022-45907
Bug: https://bugs.gentoo.org/883381
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
sci-libs/pytorch/Manifest | 1 -
.../files/pytorch-1.12.0-CVE-2022-45907.patch | 59 ++++++++++++++++++++++
sci-libs/pytorch/metadata.xml | 11 ----
sci-libs/pytorch/pytorch-1.11.0.ebuild | 58 ---------------------
...orch-1.12.0.ebuild => pytorch-1.12.0-r1.ebuild} | 3 +-
5 files changed, 61 insertions(+), 71 deletions(-)
diff --git a/sci-libs/pytorch/Manifest b/sci-libs/pytorch/Manifest
index 0d28654e641f..013309cd70ce 100644
--- a/sci-libs/pytorch/Manifest
+++ b/sci-libs/pytorch/Manifest
@@ -1,2 +1 @@
-DIST pytorch-1.11.0.tar.gz 20719323 BLAKE2B 24e7aaa2c26821d36f8092542de9d8d5ac85a619fb9fffb5131987958842afb1cad395780662d15f3411a7cc6ff83a445871960eca1e469fcbf0b9895d83d6e0 SHA512 2342eb7a1a241f5855a7cf12e11f62bc4baaa78d1d0864e53bfc946e783eb4addd05ca154a814d2376cd602098b5547e61c158d6eddb7cad5a9f3b0c1357adca
DIST pytorch-1.12.0.tar.gz 106286765 BLAKE2B ff9bafedb35f859f7dccb9b606299cf9c345bdaa0deb87ecfe0c0c30c3c828414d989e1d9a243d9b7cd3f376d56a2f81c241ca2e3c9a8a2b30cddcdeddd3a5c7 SHA512 c9c748a2e0047daaaf199a1ba3198d2d1aee47f664170a9b34ccacd3deeb95f2070e4035eeb900012ef48dc62cf6fb6806f1a1dfe22de8c94892963076e593b7
diff --git a/sci-libs/pytorch/files/pytorch-1.12.0-CVE-2022-45907.patch b/sci-libs/pytorch/files/pytorch-1.12.0-CVE-2022-45907.patch
new file mode 100644
index 000000000000..085b6d9ca1bb
--- /dev/null
+++ b/sci-libs/pytorch/files/pytorch-1.12.0-CVE-2022-45907.patch
@@ -0,0 +1,59 @@
+From 78cad998e505b667d25ac42f8aaa24409f5031e1 Mon Sep 17 00:00:00 2001
+From: Nikita Shulga <nshulga@meta.com>
+Date: Thu, 17 Nov 2022 22:05:27 +0000
+Subject: [PATCH] [JIT][Security] Do not blindly eval input string (#89189)
+
+Introduce `_eval_no_call` method, that evaluates statement only if it
+does not contain any calls(done by examining the bytecode), thus preventing command injection exploit
+
+Added simple unit test to check for that
+`torch.jit.annotations.get_signature` would not result in calling random
+code.
+
+Although, this code path exists for Python-2 compatibility, and perhaps
+should be simply removed.
+
+diff --git a/torch/jit/annotations.py b/torch/jit/annotations.py
+index a4a36ce36a5e8..a6ff2d04d2076 100644
+--- a/torch/jit/annotations.py
++++ b/torch/jit/annotations.py
+@@ -1,4 +1,5 @@
+ import ast
++import dis
+ import enum
+ import inspect
+ import re
+@@ -144,6 +145,15 @@ def check_fn(fn, loc):
+ raise torch.jit.frontend.FrontendError(loc, "Expected a single top-level function")
+
+
++def _eval_no_call(stmt, glob, loc):
++ """Evaluate statement as long as it does not contain any method/function calls"""
++ bytecode = compile(stmt, "", mode="eval")
++ for insn in dis.get_instructions(bytecode):
++ if "CALL" in insn.opname:
++ raise RuntimeError(f"Type annotation should not contain calls, but '{stmt}' does")
++ return eval(bytecode, glob, loc) # type: ignore[arg-type] # noqa: P204
++
++
+ def parse_type_line(type_line, rcb, loc):
+ """Parses a type annotation specified as a comment.
+
+@@ -154,7 +164,7 @@ def parse_type_line(type_line, rcb, loc):
+ arg_ann_str, ret_ann_str = split_type_line(type_line)
+
+ try:
+- arg_ann = eval(arg_ann_str, {}, EvalEnv(rcb)) # type: ignore[arg-type] # noqa: P204
++ arg_ann = _eval_no_call(arg_ann_str, {}, EvalEnv(rcb))
+ except (NameError, SyntaxError) as e:
+ raise RuntimeError("Failed to parse the argument list of a type annotation") from e
+
+@@ -162,7 +172,7 @@ def parse_type_line(type_line, rcb, loc):
+ arg_ann = (arg_ann,)
+
+ try:
+- ret_ann = eval(ret_ann_str, {}, EvalEnv(rcb)) # type: ignore[arg-type] # noqa: P204
++ ret_ann = _eval_no_call(ret_ann_str, {}, EvalEnv(rcb))
+ except (NameError, SyntaxError) as e:
+ raise RuntimeError("Failed to parse the return type of a type annotation") from e
+
diff --git a/sci-libs/pytorch/metadata.xml b/sci-libs/pytorch/metadata.xml
index bc2785e5f6db..d12749aa5c21 100644
--- a/sci-libs/pytorch/metadata.xml
+++ b/sci-libs/pytorch/metadata.xml
@@ -5,17 +5,6 @@
<email>tupone@gentoo.org</email>
<name>Tupone Alfredo</name>
</maintainer>
- <use>
- <flag name="cuda">Add support for CUDA processing</flag>
- <flag name="ffmpeg">Add support for video processing operators</flag>
- <flag name="nnpack">Use NNPACK</flag>
- <flag name="numpy">Add support for math operations through numpy</flag>
- <flag name="opencl">Use OpenCL</flag>
- <flag name="opencv">Add support for image processing operators</flag>
- <flag name="openmp">Use OpenMP for parallel code</flag>
- <flag name="qnnpack">Use QNNPACK</flag>
- <flag name="xnnpack">Use XNNPACK</flag>
- </use>
<upstream>
<remote-id type="github">pytorch/pytorch</remote-id>
</upstream>
diff --git a/sci-libs/pytorch/pytorch-1.11.0.ebuild b/sci-libs/pytorch/pytorch-1.11.0.ebuild
deleted file mode 100644
index 401bdea8264a..000000000000
--- a/sci-libs/pytorch/pytorch-1.11.0.ebuild
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{8,9,10} )
-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"
-IUSE="cuda ffmpeg nnpack +numpy opencl opencv openmp qnnpack xnnpack"
-
-REQUIRED_USE=${PYTHON_REQUIRED_USE}
-RDEPEND="
- ${PYTHON_DEPS}
- ~sci-libs/caffe2-${PV}[${PYTHON_USEDEP}]
- sci-libs/caffe2[cuda?,ffmpeg?,nnpack?,numpy?,opencl?,opencv?,openmp?,qnnpack?,xnnpack?]
- dev-python/typing-extensions[${PYTHON_USEDEP}]
-"
-DEPEND="${RDEPEND}
- 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
-
- # 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
-}
diff --git a/sci-libs/pytorch/pytorch-1.12.0.ebuild b/sci-libs/pytorch/pytorch-1.12.0-r1.ebuild
similarity index 92%
rename from sci-libs/pytorch/pytorch-1.12.0.ebuild
rename to sci-libs/pytorch/pytorch-1.12.0-r1.ebuild
index 0a1cae78f4bb..02fa58c7ba75 100644
--- a/sci-libs/pytorch/pytorch-1.12.0.ebuild
+++ b/sci-libs/pytorch/pytorch-1.12.0-r1.ebuild
@@ -32,7 +32,8 @@ src_prepare() {
"${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}"/pytorch-1.7.1-torch_shm_manager.patch \
+ "${FILESDIR}"/pytorch-1.12.0-CVE-2022-45907.patch
# Set build dir for pytorch's setup
sed -i \
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sci-libs/pytorch/files/, sci-libs/pytorch/
@ 2023-02-15 19:40 Alfredo Tupone
0 siblings, 0 replies; 7+ messages in thread
From: Alfredo Tupone @ 2023-02-15 19:40 UTC (permalink / raw
To: gentoo-commits
commit: de632cbceb0e91127bcaefb47e3538ca48477b15
Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 15 19:40:24 2023 +0000
Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Wed Feb 15 19:40:24 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de632cbc
sci-libs/pytorch: add 1.13.1
Closes: https://bugs.gentoo.org/893594
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
sci-libs/pytorch/Manifest | 1 +
.../files/pytorch-1.13.1-global-dlopen.patch | 23 ++++++++
sci-libs/pytorch/pytorch-1.13.1.ebuild | 62 ++++++++++++++++++++++
3 files changed, 86 insertions(+)
diff --git a/sci-libs/pytorch/Manifest b/sci-libs/pytorch/Manifest
index fba79e4a9a24..7a1c9e4370ae 100644
--- a/sci-libs/pytorch/Manifest
+++ b/sci-libs/pytorch/Manifest
@@ -1,3 +1,4 @@
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
+DIST pytorch-1.13.1.tar.gz 108279745 BLAKE2B 75de03b74dfdaf8d8fb5ea743fcc0c1b0e408a714ad4160c487921220a7b1755e5fa6e587e6bbc8c9f34dd75e096d2e6dd69c80d24821835fff6c833314434d3 SHA512 f16f89d027efade11d057245cad5b69a390e88b458398310ae30de2dbff7c8fd7f1165be7b8da7ea989c81ac3f5a66c5cb9050610e441a97c83fb8aa28c0bd62
diff --git a/sci-libs/pytorch/files/pytorch-1.13.1-global-dlopen.patch b/sci-libs/pytorch/files/pytorch-1.13.1-global-dlopen.patch
new file mode 100644
index 000000000000..4f414be67a29
--- /dev/null
+++ b/sci-libs/pytorch/files/pytorch-1.13.1-global-dlopen.patch
@@ -0,0 +1,23 @@
+Don't hardcode the library path. Leave it to the dynamic loader.
+
+Index: pytorch-1.13.1/torch/__init__.py
+===================================================================
+--- a/torch/__init__.py 2023-02-15 20:27:51.747853677 +0100
++++ b/torch/__init__.py 2023-02-15 20:28:23.506341918 +0100
+@@ -169,14 +169,14 @@
+ lib_path = os.path.join(os.path.dirname(here), 'lib', lib_name)
+
+ try:
+- ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
++ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL)
+ except OSError as err:
+ # Can only happen of wheel with cublas as PYPI deps
+ # As PyTorch is not purelib, but nvidia-cublas-cu11 is
+ if 'libcublas.so.11' not in err.args[0]:
+ raise err
+ _preload_cuda_deps()
+- ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
++ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL)
+
+
+ if (USE_RTLD_GLOBAL_WITH_LIBTORCH or os.getenv('TORCH_USE_RTLD_GLOBAL')) and \
diff --git a/sci-libs/pytorch/pytorch-1.13.1.ebuild b/sci-libs/pytorch/pytorch-1.13.1.ebuild
new file mode 100644
index 000000000000..898c43a39ba9
--- /dev/null
+++ b/sci-libs/pytorch/pytorch-1.13.1.ebuild
@@ -0,0 +1,62 @@
+# 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}"/${P}-global-dlopen.patch \
+ "${FILESDIR}"/pytorch-1.7.1-torch_shm_manager.patch \
+ "${FILESDIR}"/${PN}-1.13.0-setup.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
+}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sci-libs/pytorch/files/, sci-libs/pytorch/
@ 2023-02-22 8:04 Alfredo Tupone
0 siblings, 0 replies; 7+ messages in thread
From: Alfredo Tupone @ 2023-02-22 8:04 UTC (permalink / raw
To: gentoo-commits
commit: 32fc208629a6e23dc5c64902ab73be47a305743a
Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 22 08:03:32 2023 +0000
Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Wed Feb 22 08:03:47 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32fc2086
sci-libs/pytorch: drop 1.12.0-r2, 1.12.1, 1.13.0
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
sci-libs/pytorch/Manifest | 3 --
.../files/pytorch-1.12.0-CVE-2022-45907.patch | 59 --------------------
.../files/pytorch-1.6.0-global-dlopen.patch | 15 ------
sci-libs/pytorch/pytorch-1.12.0-r2.ebuild | 62 ---------------------
sci-libs/pytorch/pytorch-1.12.1.ebuild | 62 ---------------------
sci-libs/pytorch/pytorch-1.13.0.ebuild | 63 ----------------------
6 files changed, 264 deletions(-)
diff --git a/sci-libs/pytorch/Manifest b/sci-libs/pytorch/Manifest
index 7a1c9e4370ae..616b75a49763 100644
--- a/sci-libs/pytorch/Manifest
+++ b/sci-libs/pytorch/Manifest
@@ -1,4 +1 @@
-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
DIST pytorch-1.13.1.tar.gz 108279745 BLAKE2B 75de03b74dfdaf8d8fb5ea743fcc0c1b0e408a714ad4160c487921220a7b1755e5fa6e587e6bbc8c9f34dd75e096d2e6dd69c80d24821835fff6c833314434d3 SHA512 f16f89d027efade11d057245cad5b69a390e88b458398310ae30de2dbff7c8fd7f1165be7b8da7ea989c81ac3f5a66c5cb9050610e441a97c83fb8aa28c0bd62
diff --git a/sci-libs/pytorch/files/pytorch-1.12.0-CVE-2022-45907.patch b/sci-libs/pytorch/files/pytorch-1.12.0-CVE-2022-45907.patch
deleted file mode 100644
index 085b6d9ca1bb..000000000000
--- a/sci-libs/pytorch/files/pytorch-1.12.0-CVE-2022-45907.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 78cad998e505b667d25ac42f8aaa24409f5031e1 Mon Sep 17 00:00:00 2001
-From: Nikita Shulga <nshulga@meta.com>
-Date: Thu, 17 Nov 2022 22:05:27 +0000
-Subject: [PATCH] [JIT][Security] Do not blindly eval input string (#89189)
-
-Introduce `_eval_no_call` method, that evaluates statement only if it
-does not contain any calls(done by examining the bytecode), thus preventing command injection exploit
-
-Added simple unit test to check for that
-`torch.jit.annotations.get_signature` would not result in calling random
-code.
-
-Although, this code path exists for Python-2 compatibility, and perhaps
-should be simply removed.
-
-diff --git a/torch/jit/annotations.py b/torch/jit/annotations.py
-index a4a36ce36a5e8..a6ff2d04d2076 100644
---- a/torch/jit/annotations.py
-+++ b/torch/jit/annotations.py
-@@ -1,4 +1,5 @@
- import ast
-+import dis
- import enum
- import inspect
- import re
-@@ -144,6 +145,15 @@ def check_fn(fn, loc):
- raise torch.jit.frontend.FrontendError(loc, "Expected a single top-level function")
-
-
-+def _eval_no_call(stmt, glob, loc):
-+ """Evaluate statement as long as it does not contain any method/function calls"""
-+ bytecode = compile(stmt, "", mode="eval")
-+ for insn in dis.get_instructions(bytecode):
-+ if "CALL" in insn.opname:
-+ raise RuntimeError(f"Type annotation should not contain calls, but '{stmt}' does")
-+ return eval(bytecode, glob, loc) # type: ignore[arg-type] # noqa: P204
-+
-+
- def parse_type_line(type_line, rcb, loc):
- """Parses a type annotation specified as a comment.
-
-@@ -154,7 +164,7 @@ def parse_type_line(type_line, rcb, loc):
- arg_ann_str, ret_ann_str = split_type_line(type_line)
-
- try:
-- arg_ann = eval(arg_ann_str, {}, EvalEnv(rcb)) # type: ignore[arg-type] # noqa: P204
-+ arg_ann = _eval_no_call(arg_ann_str, {}, EvalEnv(rcb))
- except (NameError, SyntaxError) as e:
- raise RuntimeError("Failed to parse the argument list of a type annotation") from e
-
-@@ -162,7 +172,7 @@ def parse_type_line(type_line, rcb, loc):
- arg_ann = (arg_ann,)
-
- try:
-- ret_ann = eval(ret_ann_str, {}, EvalEnv(rcb)) # type: ignore[arg-type] # noqa: P204
-+ ret_ann = _eval_no_call(ret_ann_str, {}, EvalEnv(rcb))
- except (NameError, SyntaxError) as e:
- raise RuntimeError("Failed to parse the return type of a type annotation") from e
-
diff --git a/sci-libs/pytorch/files/pytorch-1.6.0-global-dlopen.patch b/sci-libs/pytorch/files/pytorch-1.6.0-global-dlopen.patch
deleted file mode 100644
index 1e9388ff17a6..000000000000
--- a/sci-libs/pytorch/files/pytorch-1.6.0-global-dlopen.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Don't hardcode the library path. Leave it to the dynamic loader.
-
-Index: pytorch-1.6.0/torch/__init__.py
-===================================================================
---- pytorch-1.6.0.orig/torch/__init__.py
-+++ pytorch-1.6.0/torch/__init__.py
-@@ -138,7 +138,7 @@ def _load_global_deps():
- here = os.path.abspath(__file__)
- lib_path = os.path.join(os.path.dirname(here), 'lib', lib_name)
-
-- ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
-+ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL)
-
-
- if (USE_RTLD_GLOBAL_WITH_LIBTORCH or os.getenv('TORCH_USE_RTLD_GLOBAL')) and \
diff --git a/sci-libs/pytorch/pytorch-1.12.0-r2.ebuild b/sci-libs/pytorch/pytorch-1.12.0-r2.ebuild
deleted file mode 100644
index 0948de848ca1..000000000000
--- a/sci-libs/pytorch/pytorch-1.12.0-r2.ebuild
+++ /dev/null
@@ -1,62 +0,0 @@
-# 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}"/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
-}
diff --git a/sci-libs/pytorch/pytorch-1.12.1.ebuild b/sci-libs/pytorch/pytorch-1.12.1.ebuild
deleted file mode 100644
index 0948de848ca1..000000000000
--- a/sci-libs/pytorch/pytorch-1.12.1.ebuild
+++ /dev/null
@@ -1,62 +0,0 @@
-# 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}"/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
-}
diff --git a/sci-libs/pytorch/pytorch-1.13.0.ebuild b/sci-libs/pytorch/pytorch-1.13.0.ebuild
deleted file mode 100644
index 7cde7f7262bb..000000000000
--- a/sci-libs/pytorch/pytorch-1.13.0.ebuild
+++ /dev/null
@@ -1,63 +0,0 @@
-# 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
-}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sci-libs/pytorch/files/, sci-libs/pytorch/
@ 2023-03-24 21:42 Alfredo Tupone
0 siblings, 0 replies; 7+ messages in thread
From: Alfredo Tupone @ 2023-03-24 21:42 UTC (permalink / raw
To: gentoo-commits
commit: f4836af254dee6b81c749b3df569d7c5bd6faa98
Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 24 21:40:49 2023 +0000
Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Fri Mar 24 21:41:36 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4836af2
sci-libs/pytorch: drop building an empty .so
Closes: https://bugs.gentoo.org/902727
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
sci-libs/pytorch/files/pytorch-1.13.1-emptyso.patch | 15 +++++++++++++++
...{pytorch-1.13.1-r1.ebuild => pytorch-1.13.1-r2.ebuild} | 1 +
2 files changed, 16 insertions(+)
diff --git a/sci-libs/pytorch/files/pytorch-1.13.1-emptyso.patch b/sci-libs/pytorch/files/pytorch-1.13.1-emptyso.patch
new file mode 100644
index 000000000000..1479354b7f7a
--- /dev/null
+++ b/sci-libs/pytorch/files/pytorch-1.13.1-emptyso.patch
@@ -0,0 +1,15 @@
+--- a/setup.py 2023-03-24 22:36:50.361860100 +0100
++++ b/setup.py 2023-03-24 22:36:57.384752383 +0100
+@@ -922,12 +922,6 @@
+ name=str('caffe2.python.caffe2_pybind11_state_hip'),
+ sources=[]),
+ )
+- if cmake_cache_vars['BUILD_FUNCTORCH']:
+- extensions.append(
+- Extension(
+- name=str('functorch._C'),
+- sources=[]),
+- )
+
+ cmdclass = {
+ 'bdist_wheel': wheel_concatenate,
diff --git a/sci-libs/pytorch/pytorch-1.13.1-r1.ebuild b/sci-libs/pytorch/pytorch-1.13.1-r2.ebuild
similarity index 97%
rename from sci-libs/pytorch/pytorch-1.13.1-r1.ebuild
rename to sci-libs/pytorch/pytorch-1.13.1-r2.ebuild
index 956c5e89cbc8..f93b9a108820 100644
--- a/sci-libs/pytorch/pytorch-1.13.1-r1.ebuild
+++ b/sci-libs/pytorch/pytorch-1.13.1-r2.ebuild
@@ -39,6 +39,7 @@ src_prepare() {
"${FILESDIR}"/${P}-global-dlopen.patch \
"${FILESDIR}"/pytorch-1.7.1-torch_shm_manager.patch \
"${FILESDIR}"/${PN}-1.13.0-setup.patch \
+ "${FILESDIR}"/${P}-emptyso.patch \
# Set build dir for pytorch's setup
sed -i \
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sci-libs/pytorch/files/, sci-libs/pytorch/
@ 2023-04-05 19:37 Alfredo Tupone
0 siblings, 0 replies; 7+ messages in thread
From: Alfredo Tupone @ 2023-04-05 19:37 UTC (permalink / raw
To: gentoo-commits
commit: d2a5c15046bab11f3e70927d6b053ab98870acf0
Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 5 19:35:41 2023 +0000
Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Wed Apr 5 19:35:58 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2a5c150
sci-libs/pytorch: add 2.0.0
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
sci-libs/pytorch/Manifest | 1 +
sci-libs/pytorch/files/pytorch-2.0.0-emptyso.patch | 15 +++++
.../files/pytorch-2.0.0-global-dlopen.patch | 20 +++++++
sci-libs/pytorch/pytorch-2.0.0.ebuild | 64 ++++++++++++++++++++++
4 files changed, 100 insertions(+)
diff --git a/sci-libs/pytorch/Manifest b/sci-libs/pytorch/Manifest
index 616b75a49763..1424256938e9 100644
--- a/sci-libs/pytorch/Manifest
+++ b/sci-libs/pytorch/Manifest
@@ -1 +1,2 @@
DIST pytorch-1.13.1.tar.gz 108279745 BLAKE2B 75de03b74dfdaf8d8fb5ea743fcc0c1b0e408a714ad4160c487921220a7b1755e5fa6e587e6bbc8c9f34dd75e096d2e6dd69c80d24821835fff6c833314434d3 SHA512 f16f89d027efade11d057245cad5b69a390e88b458398310ae30de2dbff7c8fd7f1165be7b8da7ea989c81ac3f5a66c5cb9050610e441a97c83fb8aa28c0bd62
+DIST pytorch-2.0.0.tar.gz 111327292 BLAKE2B 6d593a975c0ade714f0b189f7e3c4ff704b9a9a2377b5e441a9cefc202fa22779966d08948e63671912c6ea5a0eee124042155f4f57a654db34e19e42f013cc9 SHA512 4dd76160711c0d87f3026c8b7fa3ed149dd86b8ac0ee9ecea0eaf80d2e6ce8c29368392e77b9466d90b60634087b462b782495997a5d33367cc8ca9fe14c8a14
diff --git a/sci-libs/pytorch/files/pytorch-2.0.0-emptyso.patch b/sci-libs/pytorch/files/pytorch-2.0.0-emptyso.patch
new file mode 100644
index 000000000000..e4703894308a
--- /dev/null
+++ b/sci-libs/pytorch/files/pytorch-2.0.0-emptyso.patch
@@ -0,0 +1,15 @@
+--- a/setup.py 2023-04-05 11:23:00.713405789 +0200
++++ b/setup.py 2023-04-05 11:23:36.900876249 +0200
+@@ -960,12 +960,6 @@
+ name=str('caffe2.python.caffe2_pybind11_state_hip'),
+ sources=[]),
+ )
+- if cmake_cache_vars['BUILD_FUNCTORCH']:
+- extensions.append(
+- Extension(
+- name=str('functorch._C'),
+- sources=[]),
+- )
+ if cmake_cache_vars['BUILD_NVFUSER']:
+ extensions.append(
+ Extension(
diff --git a/sci-libs/pytorch/files/pytorch-2.0.0-global-dlopen.patch b/sci-libs/pytorch/files/pytorch-2.0.0-global-dlopen.patch
new file mode 100644
index 000000000000..0f1b400e234d
--- /dev/null
+++ b/sci-libs/pytorch/files/pytorch-2.0.0-global-dlopen.patch
@@ -0,0 +1,20 @@
+--- a/torch/__init__.py 2023-04-05 11:12:25.682681130 +0200
++++ b/torch/__init__.py 2023-04-05 11:13:00.640170307 +0200
+@@ -165,7 +165,7 @@
+ lib_path = os.path.join(os.path.dirname(here), 'lib', lib_name)
+
+ try:
+- ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
++ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL)
+ except OSError as err:
+ # Can only happen for wheel with cuda libs as PYPI deps
+ # As PyTorch is not purelib, but nvidia-*-cu11 is
+@@ -187,7 +187,7 @@
+ raise err
+ for lib_folder, lib_name in cuda_libs.items():
+ _preload_cuda_deps(lib_folder, lib_name)
+- ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
++ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL)
+
+
+ if (USE_RTLD_GLOBAL_WITH_LIBTORCH or os.getenv('TORCH_USE_RTLD_GLOBAL')) and \
diff --git a/sci-libs/pytorch/pytorch-2.0.0.ebuild b/sci-libs/pytorch/pytorch-2.0.0.ebuild
new file mode 100644
index 000000000000..506f1889b280
--- /dev/null
+++ b/sci-libs/pytorch/pytorch-2.0.0.ebuild
@@ -0,0 +1,64 @@
+# 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..11} )
+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}]
+ dev-python/sympy[${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}"/${P}-global-dlopen.patch \
+ "${FILESDIR}"/pytorch-1.7.1-torch_shm_manager.patch \
+ "${FILESDIR}"/${PN}-1.13.0-setup.patch \
+ "${FILESDIR}"/${P}-emptyso.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
+}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sci-libs/pytorch/files/, sci-libs/pytorch/
@ 2024-08-08 16:27 Alfredo Tupone
0 siblings, 0 replies; 7+ messages in thread
From: Alfredo Tupone @ 2024-08-08 16:27 UTC (permalink / raw
To: gentoo-commits
commit: a2db294c0aa48d06c1bfb1df039cb4710bbc2848
Author: Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Thu Aug 8 03:59:39 2024 +0000
Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Thu Aug 8 16:22:32 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a2db294c
sci-libs/pytorch: add 2.4.0
No new patches, 3 patches required manual conflict resolution
Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/38013
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
sci-libs/pytorch/Manifest | 1 +
.../files/pytorch-2.4.0-dontbuildagain.patch | 17 ++++++
.../files/pytorch-2.4.0-global-dlopen.patch | 20 +++++++
.../files/pytorch-2.4.0-torch_shm_manager.patch | 11 ++++
sci-libs/pytorch/pytorch-2.4.0.ebuild | 66 ++++++++++++++++++++++
5 files changed, 115 insertions(+)
diff --git a/sci-libs/pytorch/Manifest b/sci-libs/pytorch/Manifest
index 246ab4d21a1a..f34355be2e16 100644
--- a/sci-libs/pytorch/Manifest
+++ b/sci-libs/pytorch/Manifest
@@ -1,3 +1,4 @@
DIST pytorch-2.2.2.tar.gz 116367503 BLAKE2B 0be22f2ec4b9aac6f5e976664cae01facf07929a32565cd57d7cc5b2d9888e9ae71ca301853752fe8f31d174d04c9974eb9ed2f3d452360a50ccf024f200726a SHA512 7990e0f9484038c3458c0bda2c863bf2b19e56edab81fc5938c6e0f08b17558287f853bb67350e8cca8f42bec0f1d4ba0e94e50a145db8da44bdd4bd703d91d0
DIST pytorch-2.3.0.tar.gz 117029829 BLAKE2B 8f9c0d71ee0a9219b495eddccdcc65107f7ad537c43c68100b229f3d27b0e6c01ccb1659c7fffc356a48d80f2adc0a10361305dc8f1df20446de837d380f89f6 SHA512 67f7e9a096c3ffb952206ebf9105bedebb68c24ad82456083adf1d1d210437fcaa9dd52b68484cfc97d408c9eebc9541c76868c34a7c9982494dc3f424cfb07c
DIST pytorch-2.3.1.tar.gz 117035696 BLAKE2B d419d7fa1342f1fb317ffce09ec9dc1447414627cc83d36578fe60f68c283c620b2b4d49f414cd206d537b90b16432a06cd1941662720db05d5e2b6c493325f5 SHA512 e1bcae44f9939fc7ccb1360a9b1970d92426f25e5de73e36964df3dd15ad5d8d9f5bd2f9a7dda6b8f64e2bba3674005bd869f542489cc442ad0125a02676f587
+DIST pytorch-2.4.0.tar.gz 115031093 BLAKE2B d206477963977011627df284efa01482fbf57e9fcb5f58f51d679c742b8e5dde6aa6affd8745ab817fcd09477d129a81e74e07be576b5d3585eaca1c735b8e01 SHA512 804d25944035f33de6591fd942fbda44d3de037717a4397d38a97474b01775d30eaf93d16dd708a832c0119050d24d73b90990fd3e3773be79d26ada25244d22
diff --git a/sci-libs/pytorch/files/pytorch-2.4.0-dontbuildagain.patch b/sci-libs/pytorch/files/pytorch-2.4.0-dontbuildagain.patch
new file mode 100644
index 000000000000..4fe5b0bdeb86
--- /dev/null
+++ b/sci-libs/pytorch/files/pytorch-2.4.0-dontbuildagain.patch
@@ -0,0 +1,17 @@
+--- a/setup.py
++++ b/setup.py
+@@ -473,14 +473,6 @@ def build_deps():
+ check_pydep("yaml", "pyyaml")
+ build_python = not BUILD_LIBTORCH_WHL
+
+- build_caffe2(
+- 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/files/pytorch-2.4.0-global-dlopen.patch b/sci-libs/pytorch/files/pytorch-2.4.0-global-dlopen.patch
new file mode 100644
index 000000000000..e72ed94e6888
--- /dev/null
+++ b/sci-libs/pytorch/files/pytorch-2.4.0-global-dlopen.patch
@@ -0,0 +1,20 @@
+--- a/torch/__init__.py
++++ b/torch/__init__.py
+@@ -223,7 +223,7 @@ def _load_global_deps() -> None:
+ if library_path:
+ global_deps_lib_path = os.path.join(library_path, 'lib', lib_name)
+ try:
+- ctypes.CDLL(global_deps_lib_path, mode=ctypes.RTLD_GLOBAL)
++ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL)
+ except OSError as err:
+ # Can only happen for wheel with cuda libs as PYPI deps
+ # As PyTorch is not purelib, but nvidia-*-cu12 is
+@@ -245,7 +245,7 @@ def _load_global_deps() -> None:
+ raise err
+ for lib_folder, lib_name in cuda_libs.items():
+ _preload_cuda_deps(lib_folder, lib_name)
+- ctypes.CDLL(global_deps_lib_path, mode=ctypes.RTLD_GLOBAL)
++ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL)
+
+ if library_path:
+ # loading libtorch_global_deps first due its special logic
diff --git a/sci-libs/pytorch/files/pytorch-2.4.0-torch_shm_manager.patch b/sci-libs/pytorch/files/pytorch-2.4.0-torch_shm_manager.patch
new file mode 100644
index 000000000000..b1303d141dce
--- /dev/null
+++ b/sci-libs/pytorch/files/pytorch-2.4.0-torch_shm_manager.patch
@@ -0,0 +1,11 @@
+--- a/torch/__init__.py
++++ b/torch/__init__.py
+@@ -1691,7 +1691,7 @@ py_float = float
+ py_int = int
+
+ # Shared memory manager needs to know the exact location of manager executable
+-_C._initExtension(_manager_path())
++_C._initExtension(b"/usr/bin/torch_shm_manager")
+ del _manager_path
+
+ # Appease the type checker: it can't deal with direct setting of globals().
diff --git a/sci-libs/pytorch/pytorch-2.4.0.ebuild b/sci-libs/pytorch/pytorch-2.4.0.ebuild
new file mode 100644
index 000000000000..31e3b0439a9d
--- /dev/null
+++ b/sci-libs/pytorch/pytorch-2.4.0.ebuild
@@ -0,0 +1,66 @@
+# Copyright 2022-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..12} )
+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}]
+ $(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}"/${PN}-2.4.0-dontbuildagain.patch \
+ "${FILESDIR}"/pytorch-1.9.0-Change-library-directory-according-to-CMake-build.patch \
+ "${FILESDIR}"/${PN}-2.4.0-global-dlopen.patch \
+ "${FILESDIR}"/pytorch-2.4.0-torch_shm_manager.patch \
+ "${FILESDIR}"/${PN}-1.13.0-setup.patch \
+ "${FILESDIR}"/${PN}-2.2.1-emptyso.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
+
+ 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
+}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sci-libs/pytorch/files/, sci-libs/pytorch/
@ 2024-10-27 13:45 Alfredo Tupone
0 siblings, 0 replies; 7+ messages in thread
From: Alfredo Tupone @ 2024-10-27 13:45 UTC (permalink / raw
To: gentoo-commits
commit: 67a2c55cf70328f76b08611c6445031c029188d2
Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 27 13:44:41 2024 +0000
Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Sun Oct 27 13:44:41 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=67a2c55c
sci-libs/pytorch: drop 2.3.0, 2.3.1
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
sci-libs/pytorch/Manifest | 2 -
.../files/pytorch-1.7.1-torch_shm_manager.patch | 13 -----
.../files/pytorch-2.0.0-global-dlopen.patch | 20 -------
.../files/pytorch-2.1.1-dontbuildagain.patch | 17 ------
sci-libs/pytorch/pytorch-2.3.0.ebuild | 66 ----------------------
sci-libs/pytorch/pytorch-2.3.1.ebuild | 66 ----------------------
6 files changed, 184 deletions(-)
diff --git a/sci-libs/pytorch/Manifest b/sci-libs/pytorch/Manifest
index abce85ddf365..df910a695333 100644
--- a/sci-libs/pytorch/Manifest
+++ b/sci-libs/pytorch/Manifest
@@ -1,4 +1,2 @@
-DIST pytorch-2.3.0.tar.gz 117029829 BLAKE2B 8f9c0d71ee0a9219b495eddccdcc65107f7ad537c43c68100b229f3d27b0e6c01ccb1659c7fffc356a48d80f2adc0a10361305dc8f1df20446de837d380f89f6 SHA512 67f7e9a096c3ffb952206ebf9105bedebb68c24ad82456083adf1d1d210437fcaa9dd52b68484cfc97d408c9eebc9541c76868c34a7c9982494dc3f424cfb07c
-DIST pytorch-2.3.1.tar.gz 117035696 BLAKE2B d419d7fa1342f1fb317ffce09ec9dc1447414627cc83d36578fe60f68c283c620b2b4d49f414cd206d537b90b16432a06cd1941662720db05d5e2b6c493325f5 SHA512 e1bcae44f9939fc7ccb1360a9b1970d92426f25e5de73e36964df3dd15ad5d8d9f5bd2f9a7dda6b8f64e2bba3674005bd869f542489cc442ad0125a02676f587
DIST pytorch-2.4.0.tar.gz 115031093 BLAKE2B d206477963977011627df284efa01482fbf57e9fcb5f58f51d679c742b8e5dde6aa6affd8745ab817fcd09477d129a81e74e07be576b5d3585eaca1c735b8e01 SHA512 804d25944035f33de6591fd942fbda44d3de037717a4397d38a97474b01775d30eaf93d16dd708a832c0119050d24d73b90990fd3e3773be79d26ada25244d22
DIST pytorch-2.4.1.tar.gz 115029469 BLAKE2B c2909ff27d527bc57cba56b780d3b8cd07a043ab045caa6c6b27857a16f9ad10aaab2116b26226b1e46ee08ffb44007965d914464418e4ae14ca48c3f3f383bb SHA512 7e9b4485e242eaf0d648765c6621d73d95e7107b766646a098175436d1ab2e2b864badd0757a3bab6b7c318233f2120bad9ac07b39bb9e357897919580c87631
diff --git a/sci-libs/pytorch/files/pytorch-1.7.1-torch_shm_manager.patch b/sci-libs/pytorch/files/pytorch-1.7.1-torch_shm_manager.patch
deleted file mode 100644
index 69c2ddc5947e..000000000000
--- a/sci-libs/pytorch/files/pytorch-1.7.1-torch_shm_manager.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/torch/__init__.py b/torch/__init__.py
-index 03f6eca622..297fb169a4 100644
---- a/torch/__init__.py
-+++ b/torch/__init__.py
-@@ -412,7 +412,7 @@ def manager_path():
-
-
- # Shared memory manager needs to know the exact location of manager executable
--_C._initExtension(manager_path())
-+_C._initExtension(b"/usr/bin/torch_shm_manager")
- del manager_path
-
- # Appease the type checker: it can't deal with direct setting of globals().
diff --git a/sci-libs/pytorch/files/pytorch-2.0.0-global-dlopen.patch b/sci-libs/pytorch/files/pytorch-2.0.0-global-dlopen.patch
deleted file mode 100644
index 0f1b400e234d..000000000000
--- a/sci-libs/pytorch/files/pytorch-2.0.0-global-dlopen.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/torch/__init__.py 2023-04-05 11:12:25.682681130 +0200
-+++ b/torch/__init__.py 2023-04-05 11:13:00.640170307 +0200
-@@ -165,7 +165,7 @@
- lib_path = os.path.join(os.path.dirname(here), 'lib', lib_name)
-
- try:
-- ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
-+ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL)
- except OSError as err:
- # Can only happen for wheel with cuda libs as PYPI deps
- # As PyTorch is not purelib, but nvidia-*-cu11 is
-@@ -187,7 +187,7 @@
- raise err
- for lib_folder, lib_name in cuda_libs.items():
- _preload_cuda_deps(lib_folder, lib_name)
-- ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
-+ ctypes.CDLL(lib_name, mode=ctypes.RTLD_GLOBAL)
-
-
- if (USE_RTLD_GLOBAL_WITH_LIBTORCH or os.getenv('TORCH_USE_RTLD_GLOBAL')) and \
diff --git a/sci-libs/pytorch/files/pytorch-2.1.1-dontbuildagain.patch b/sci-libs/pytorch/files/pytorch-2.1.1-dontbuildagain.patch
deleted file mode 100644
index f031a7345c69..000000000000
--- a/sci-libs/pytorch/files/pytorch-2.1.1-dontbuildagain.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- a/setup.py 2023-12-07 20:38:21.247250326 +0100
-+++ b/setup.py 2023-12-07 20:38:30.707272148 +0100
-@@ -455,14 +455,6 @@
- check_submodules()
- check_pydep("yaml", "pyyaml")
-
-- build_caffe2(
-- version=version,
-- cmake_python_library=cmake_python_library,
-- build_python=True,
-- rerun_cmake=RERUN_CMAKE,
-- cmake_only=CMAKE_ONLY,
-- cmake=cmake,
-- )
-
- if CMAKE_ONLY:
- report(
diff --git a/sci-libs/pytorch/pytorch-2.3.0.ebuild b/sci-libs/pytorch/pytorch-2.3.0.ebuild
deleted file mode 100644
index 75fbde095842..000000000000
--- a/sci-libs/pytorch/pytorch-2.3.0.ebuild
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright 2022-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{10..12} )
-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}]
- $(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}"/${PN}-2.1.1-dontbuildagain.patch \
- "${FILESDIR}"/pytorch-1.9.0-Change-library-directory-according-to-CMake-build.patch \
- "${FILESDIR}"/${PN}-2.0.0-global-dlopen.patch \
- "${FILESDIR}"/pytorch-1.7.1-torch_shm_manager.patch \
- "${FILESDIR}"/${PN}-1.13.0-setup.patch \
- "${FILESDIR}"/${PN}-2.2.1-emptyso.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
-
- 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
-}
diff --git a/sci-libs/pytorch/pytorch-2.3.1.ebuild b/sci-libs/pytorch/pytorch-2.3.1.ebuild
deleted file mode 100644
index 75fbde095842..000000000000
--- a/sci-libs/pytorch/pytorch-2.3.1.ebuild
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright 2022-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{10..12} )
-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}]
- $(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}"/${PN}-2.1.1-dontbuildagain.patch \
- "${FILESDIR}"/pytorch-1.9.0-Change-library-directory-according-to-CMake-build.patch \
- "${FILESDIR}"/${PN}-2.0.0-global-dlopen.patch \
- "${FILESDIR}"/pytorch-1.7.1-torch_shm_manager.patch \
- "${FILESDIR}"/${PN}-1.13.0-setup.patch \
- "${FILESDIR}"/${PN}-2.2.1-emptyso.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
-
- 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
-}
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-10-27 13:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-22 8:04 [gentoo-commits] repo/gentoo:master commit in: sci-libs/pytorch/files/, sci-libs/pytorch/ Alfredo Tupone
-- strict thread matches above, loose matches on Subject: below --
2024-10-27 13:45 Alfredo Tupone
2024-08-08 16:27 Alfredo Tupone
2023-04-05 19:37 Alfredo Tupone
2023-03-24 21:42 Alfredo Tupone
2023-02-15 19:40 Alfredo Tupone
2022-11-30 18:13 Alfredo Tupone
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox