From 31f2d624a3a4bce4092c51c9878f925aaa0de4b7 Mon Sep 17 00:00:00 2001 From: totaam Date: Thu, 24 Nov 2022 17:46:36 +0700 Subject: [PATCH] avoid pycuda import warnings on win32 --- packaging/MSWindows/MINGW_BUILD.sh | 5 +++++ xpra/codecs/nvidia/cuda_context.py | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packaging/MSWindows/MINGW_BUILD.sh b/packaging/MSWindows/MINGW_BUILD.sh index 7c64e0f1c3..a74155d3cb 100644 --- a/packaging/MSWindows/MINGW_BUILD.sh +++ b/packaging/MSWindows/MINGW_BUILD.sh @@ -500,6 +500,11 @@ if [ "${BUNDLE_DESKTOPLOGON}" == "1" ]; then done fi +if [ "${DO_CUDA}" == "1" ]; then + #pycuda wants a CUDA_PATH with "/bin" in it: + mkdir "${DIST}/bin" +fi + if [ "${DO_VERPATCH}" == "1" ]; then for exe in `ls dist/*exe | grep -v Plink.exe`; do tool_name=`echo $exe | sed 's+dist/++g;s+Xpra_++g;s+Xpra-++g;s+_+ +g;s+-+ +g;s+\.exe++g'` diff --git a/xpra/codecs/nvidia/cuda_context.py b/xpra/codecs/nvidia/cuda_context.py index ab38717905..6ba8eeb22f 100755 --- a/xpra/codecs/nvidia/cuda_context.py +++ b/xpra/codecs/nvidia/cuda_context.py @@ -16,11 +16,14 @@ from xpra.util import engs, print_nested_dict, envint, envbool, csv, first_time from xpra.platform.paths import ( get_default_conf_dirs, get_system_conf_dirs, get_user_conf_dirs, - get_resources_dir, + get_resources_dir, get_app_dir, ) -from xpra.os_util import load_binary_file, is_WSL +from xpra.os_util import load_binary_file, is_WSL, WIN32 from xpra.log import Logger +if WIN32 and not os.environ.get("CUDA_PATH"): + os.environ["CUDA_PATH"] = os.path.join(get_app_dir(), "bin") + with numpy_import_lock: if is_WSL() and not envbool("XPRA_PYCUDA_WSL", False): raise ImportError("refusing to import pycuda on WSL, use XPRA_PYCUDA_WSL=1 to override")