Skip to content
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file.

## 3.3.1

* Remove root user option from the usage of the preCICE image in the release workflow https://github.com/precice/python-bindings/commit/0a9ccd449e875f0165bebc968b3a23d6d9094b0d
* Fix release workflow by using the correct image in the container https://github.com/precice/python-bindings/commit/63c594678490718474b33f225b05cc5f19f8b569
* Run the upload package creation workflow on the latest preCICE release image https://github.com/precice/python-bindings/commit/9c3ad2e832ac1c1e5c03a189788eead00f97744b

## 3.3.0

* Renaming and using a newer workflow for publishing according to the trusted publishing in PyPI https://github.com/precice/python-bindings/pull/241
Expand Down
30 changes: 16 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pathlib
from setuptools import setup
from Cython.Distutils.extension import Extension
from Cython.Build import cythonize
Expand All @@ -9,32 +8,35 @@
MOCKED_ENV = "PYPRECICE_MOCKED"


def get_extensions():
def find_precice():
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(
"pkg-config was unable to find libprecice.\n"
"Please make sure that preCICE was installed correctly and pkg-config is able to find it.\n"
"You may need to set PKG_CONFIG_PATH to include the location of the libprecice.pc file.\n"
'Use "pkg-config --modversion libprecice" for debugging.'
)
return [], ["-lprecice"]

version = pkgconfig.modversion("libprecice")
print(f"Found preCICE version {version}")
return pkgconfig.cflags("libprecice").split(), pkgconfig.libs("libprecice").split()

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

def get_extensions():
cflags, ldflags = find_precice()

compile_args = ["-std=c++17"]
link_args = []
include_dirs = [numpy.get_include()]
bindings_sources = ["cyprecice/cyprecice.pyx"]
compile_args += pkgconfig.cflags("libprecice").split()
compile_args += cflags

if os.environ.get(MOCKED_ENV) is not None:
print(f"Building mocked pyprecice as {MOCKED_ENV} is set")
bindings_sources.append("test/Participant.cpp")
else:
link_args += pkgconfig.libs("libprecice").split()
link_args += ldflags

return [
Extension(
Expand Down