Skip to content

Commit

Permalink
setup.py: correctly handle None in library_dirs or include_dirs
Browse files Browse the repository at this point in the history
If any of the entries in this list are None, cythonize (called in an
argument of setup at the end) will throw errors. The entries can be None
when the user has not set the environment variables for the MPI and FFTW
directories.
  • Loading branch information
Kishore96in authored and kburns committed Sep 15, 2023
1 parent 026decd commit 37a651b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,19 @@ def read(rel_path):
else:
raise RuntimeError("Unable to find version string.")

# C-dependency paths for extension compilation and linking
include_dirs = ['dedalus/libraries/fftw/',
def filter_none(l):
return [d for d in l if d is not None]

# C-dependency paths for extension compilation and linking. Note that cythonize will later throw errors if any of the entries below turn out to be None.
include_dirs = filter_none([
'dedalus/libraries/fftw/',
np.get_include(),
mpi4py.get_include(),
get_include('mpi'),
get_include('fftw')]
get_include('fftw'),
])
libraries = ['fftw3_mpi', 'fftw3', 'm']
library_dirs = [get_lib('fftw'), get_lib('mpi')]
library_dirs = filter_none([get_lib('fftw'), get_lib('mpi')])

# Warning supression
extra_compile_args = ["-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION",
Expand Down

0 comments on commit 37a651b

Please sign in to comment.