Skip to content

Commit

Permalink
remove use of distutils (#333)
Browse files Browse the repository at this point in the history
* replace use of distutils.LooseVersion with numpy.lib.NumpyVersion

distutils is deprecated in Python 3.10 and will be removed in 3.12

* Avoid use of deprecated distutils from setup.py
  • Loading branch information
grlee77 committed Dec 17, 2021
1 parent c6df746 commit ca89652
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pyfftw/interfaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@
except ImportError:
pass
else:
from distutils.version import LooseVersion as _LooseVersion
from numpy.lib import NumpyVersion

has_scipy_fft = _LooseVersion(scipy.__version__) >= _LooseVersion('1.4.0')
del _LooseVersion
has_scipy_fft = NumpyVersion(scipy.__version__) >= NumpyVersion('1.4.0')
del NumpyVersion
del scipy

from . import scipy_fftpack
Expand Down
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@
from setuptools import setup, Command
from setuptools.command.build_ext import build_ext

from distutils.errors import CompileError, LinkError
from distutils.extension import Extension
from distutils.util import get_platform
try:
from setuptools.errors import CompileError, LinkError
from setuptools.extension import Extension
except ImportError:
# fallback to distutils for older setuptools releases
from distutils.errors import CompileError, LinkError
from distutils.extension import Extension
from pkg_resources import get_platform

from contextlib import redirect_stderr, redirect_stdout
import os
Expand Down

0 comments on commit ca89652

Please sign in to comment.