Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Allow building sdist even if FFTW libs are not found #42

Merged
merged 1 commit into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading