Skip to content

Commit

Permalink
build: Allow building sdist even if FFTW libs are not found
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcinl committed May 12, 2024
1 parent a69790e commit 2ef7c72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include *.py *.txt *.rst
recursive-include mpi4py_fft *.py *.pyx *.pxd fftw_planxfftn.[c,h]
recursive-exclude mpi4py_fft fftw[f,l]_xfftn.pyx fftw[f,l]_xfftn.pxd
recursive-exclude mpi4py_fft fftw[f,l]_xfftn.pyx fftw[f,l]_xfftn.pxd
12 changes: 10 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import platform
import sysconfig
from distutils import ccompiler
from distutils.errors import DistutilsPlatformError
from setuptools import setup
from setuptools.dist import Distribution
from setuptools.extension import Extension
Expand Down Expand Up @@ -74,7 +75,9 @@ def get_fftw_libs():
libs[d].append(tlib)
if os.name == 'posix':
libs[d].append('m')
assert len(libs) > 0, "No FFTW libraries found in {}".format(library_dirs)
if not libs:
message = "No FFTW libraries found in {}".format(library_dirs)
raise DistutilsPlatformError(message)
return libs

def generate_extensions(fftwlibs, force=True):
Expand Down Expand Up @@ -149,7 +152,12 @@ def get_extensions():
),
]

fftwlibs = get_fftw_libs()
sdist = 'sdist' in sys.argv
egg_info = 'egg_info' in sys.argv
fftwlibs = (
get_fftw_libs() if not (sdist or egg_info) else
{d: [] for d in ('float', 'double', 'long double')}
)
for d, libs in fftwlibs.items():
p = 'fftw' + prec_map[d] + '_'
ext.append(
Expand Down

0 comments on commit 2ef7c72

Please sign in to comment.