Skip to content

Commit 2ef7c72

Browse files
committedMay 12, 2024·
build: Allow building sdist even if FFTW libs are not found
1 parent a69790e commit 2ef7c72

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed
 

‎MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
include *.py *.txt *.rst
22
recursive-include mpi4py_fft *.py *.pyx *.pxd fftw_planxfftn.[c,h]
3-
recursive-exclude mpi4py_fft fftw[f,l]_xfftn.pyx fftw[f,l]_xfftn.pxd
3+
recursive-exclude mpi4py_fft fftw[f,l]_xfftn.pyx fftw[f,l]_xfftn.pxd

‎setup.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import platform
88
import sysconfig
99
from distutils import ccompiler
10+
from distutils.errors import DistutilsPlatformError
1011
from setuptools import setup
1112
from setuptools.dist import Distribution
1213
from setuptools.extension import Extension
@@ -74,7 +75,9 @@ def get_fftw_libs():
7475
libs[d].append(tlib)
7576
if os.name == 'posix':
7677
libs[d].append('m')
77-
assert len(libs) > 0, "No FFTW libraries found in {}".format(library_dirs)
78+
if not libs:
79+
message = "No FFTW libraries found in {}".format(library_dirs)
80+
raise DistutilsPlatformError(message)
7881
return libs
7982

8083
def generate_extensions(fftwlibs, force=True):
@@ -149,7 +152,12 @@ def get_extensions():
149152
),
150153
]
151154

152-
fftwlibs = get_fftw_libs()
155+
sdist = 'sdist' in sys.argv
156+
egg_info = 'egg_info' in sys.argv
157+
fftwlibs = (
158+
get_fftw_libs() if not (sdist or egg_info) else
159+
{d: [] for d in ('float', 'double', 'long double')}
160+
)
153161
for d, libs in fftwlibs.items():
154162
p = 'fftw' + prec_map[d] + '_'
155163
ext.append(

0 commit comments

Comments
 (0)
Please sign in to comment.