Skip to content

Commit

Permalink
#3974 Python 3.12 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Aug 25, 2023
1 parent 1264806 commit 1da51d4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packaging/rpm/patches/pycuda-py3.12.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/aksetup_helper.py 2023-08-25 15:28:31.955661823 +0700
+++ b/aksetup_helper.py 2023-08-25 15:29:03.838431471 +0700
@@ -35,10 +35,14 @@


def get_numpy_incpath():
- from imp import find_module
+ from os.path import join, basename
# avoid actually importing numpy, it screws up distutils
- file, pathname, descr = find_module("numpy")
- from os.path import join
+ try:
+ from imp import find_module
+ file, pathname, descr = find_module("numpy")
+ except ImportError:
+ from importlib import util
+ pathname = basename(util.find_spec("numpy").origin)
return join(pathname, "core", "include")


2 changes: 2 additions & 0 deletions packaging/rpm/python3-pycuda.spec
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Source0: https://files.pythonhosted.org/packages/78/09/9df5358ffb74d22524
%else
Source0: https://files.pythonhosted.org/packages/2d/1f/48a3a5b2c715345e7af1e09361100bd98c3d72b4025371692ab233f523d3/pycuda-%{version}.tar.gz
%endif
Patch1: pycuda-py3.12.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: %{python3}-pycuda

Expand Down Expand Up @@ -74,6 +75,7 @@ if [ "${sha256}" != "acd9030d93e76e60b122e33ad16bcf01bb1344f4c304dedff1cd2bffb0f
exit 1
fi
%setup -q -n pycuda-%{version}
%patch -p1 -P 1

%build
CUDA=/opt/cuda
Expand Down

0 comments on commit 1da51d4

Please sign in to comment.