Merge pull request #272052 from GaetanLepage/torchaudio

python311Packages.torchaudio: fix build when cudaSupport is enabled
This commit is contained in:
Martin Weinelt 2023-12-04 16:06:20 +01:00 committed by GitHub
commit 739d72c5c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,32 @@
From 789ec77d09171f22d82006493cafbcf2496b4f8f Mon Sep 17 00:00:00 2001
From: Someone Serge <sergei.kozlukov@aalto.fi>
Date: Sat, 2 Dec 2023 12:47:00 +0000
Subject: [PATCH] setup.py: propagate cmakeFlags
---
tools/setup_helpers/extension.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/setup_helpers/extension.py b/tools/setup_helpers/extension.py
index 2415bbae..7c2a9351 100644
--- a/tools/setup_helpers/extension.py
+++ b/tools/setup_helpers/extension.py
@@ -1,6 +1,7 @@
import distutils.sysconfig
import os
import platform
+import shlex
import subprocess
from pathlib import Path
@@ -141,6 +142,8 @@ class CMakeBuild(build_ext):
f"-DUSE_OPENMP:BOOL={'ON' if _USE_OPENMP else 'OFF'}",
f"-DUSE_FFMPEG:BOOL={'ON' if _USE_FFMPEG else 'OFF'}",
]
+ if "cmakeFlags" in os.environ:
+ cmake_args.extend(shlex.split(os.environ["cmakeFlags"]))
build_args = ["--target", "install"]
# Pass CUDA architecture to cmake
if _TORCH_CUDA_ARCH_LIST is not None:
--
2.42.0

View file

@ -24,6 +24,10 @@ buildPythonPackage rec {
hash = "sha256-5UlnOGXXFu1p9M5B+Ixc9DW5hLZ1nskv81Y+McbWu6Q=";
};
patches = [
./0001-setup.py-propagate-cmakeFlags.patch
];
postPatch = ''
substituteInPlace setup.py \
--replace 'print(" --- Initializing submodules")' "return" \