Skip to content

Commit

Permalink
Improve install error messages (#223)
Browse files Browse the repository at this point in the history
* Add useful error on pkg-config failure

* Disable NumPy warning
  • Loading branch information
fsimonis authored Oct 23, 2024
1 parent 76ae917 commit dc7e520
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ def get_extensions(is_test):
bindings_sources = [os.path.join(PYTHON_BINDINGS_PATH, "cyprecice",
"cyprecice" + ".pyx")]

if not pkgconfig.exists('libprecice'):
raise Exception("\n".join([
"pkg-config was unable to find libprecice.",
"Please make sure that preCICE was installed correctly and pkg-config is able to find it.",
"You may need to set PKG_CONFIG_PATH to include the location of the libprecice.pc file.",
"Use \"pkg-config --modversion libprecice\" for debugging."]))

print("Found preCICE version " + pkgconfig.modversion('libprecice'))

compile_args += pkgconfig.cflags('libprecice').split()

if not is_test:
Expand All @@ -74,7 +83,8 @@ def get_extensions(is_test):
language="c++",
include_dirs=include_dirs,
extra_compile_args=compile_args,
extra_link_args=link_args
extra_link_args=link_args,
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
)
]

Expand Down

0 comments on commit dc7e520

Please sign in to comment.