Skip to content

Commit dc7e520

Browse files
authored
Improve install error messages (#223)
* Add useful error on pkg-config failure * Disable NumPy warning
1 parent 76ae917 commit dc7e520

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

setup.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ def get_extensions(is_test):
5858
bindings_sources = [os.path.join(PYTHON_BINDINGS_PATH, "cyprecice",
5959
"cyprecice" + ".pyx")]
6060

61+
if not pkgconfig.exists('libprecice'):
62+
raise Exception("\n".join([
63+
"pkg-config was unable to find libprecice.",
64+
"Please make sure that preCICE was installed correctly and pkg-config is able to find it.",
65+
"You may need to set PKG_CONFIG_PATH to include the location of the libprecice.pc file.",
66+
"Use \"pkg-config --modversion libprecice\" for debugging."]))
67+
68+
print("Found preCICE version " + pkgconfig.modversion('libprecice'))
69+
6170
compile_args += pkgconfig.cflags('libprecice').split()
6271

6372
if not is_test:
@@ -74,7 +83,8 @@ def get_extensions(is_test):
7483
language="c++",
7584
include_dirs=include_dirs,
7685
extra_compile_args=compile_args,
77-
extra_link_args=link_args
86+
extra_link_args=link_args,
87+
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
7888
)
7989
]
8090

0 commit comments

Comments
 (0)