Skip to content

Commit 890dd81

Browse files
committed
better error if cmake not found
1 parent a8dea93 commit 890dd81

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = msise00
3-
version = 1.9.0
3+
version = 1.9.1
44
description = Python API for Fortran MSISE-00 neutral atmosphere model.
55
author = Michael Hirsch, Ph.D.
66
author_email = scivision@users.noreply.github.com

src/msise00/base.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ def cmake(setup_file: Path):
3131
"""
3232
attempt to build using CMake
3333
"""
34-
exe = shutil.which("ctest")
35-
if not exe:
36-
raise FileNotFoundError("CMake not available")
3734

38-
subprocess.check_call([exe, "-S", str(setup_file), "-VV"])
35+
subprocess.check_call(["ctest", "-S", str(setup_file), "-VV"])
3936

4037

4138
def run(
@@ -127,6 +124,13 @@ def rungtd1d(time: datetime, altkm: float, glat: float, glon: float, indices: di
127124
if os.name == "nt":
128125
exe_name += ".exe"
129126
if not importlib.resources.is_resource(__package__, exe_name):
127+
# check for CMake here to avoid "generator didn't stop after throw() higher level raise"
128+
if not shutil.which("ctest"):
129+
raise FileNotFoundError("""
130+
CMake not available. try installing CMake like:
131+
132+
pip install cmake""")
133+
130134
with importlib.resources.path(__package__, "setup.cmake") as setup_file:
131135
cmake(setup_file)
132136
if not importlib.resources.is_resource(__package__, exe_name):

0 commit comments

Comments
 (0)