Skip to content

Commit 890b993

Browse files
committed
Fix unused pysb2amici / sbml2amici / DEExporter compiler argument (#2168)
This was ignored since switching to CMake-based builds. Now it works again. The value of `compiler` is forwarded to the `CXX` environment variable when CMake is invoked. Fixes #2140
1 parent 3c5e997 commit 890b993

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

python/sdist/amici/de_export.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,7 +2692,8 @@ class DEExporter:
26922692
due to numerical errors
26932693
26942694
:ivar compiler:
2695-
distutils/setuptools compiler selection to build the Python extension
2695+
Absolute path to the compiler executable to be used to build the Python
2696+
extension, e.g. ``/usr/bin/clang``.
26962697
26972698
:ivar functions:
26982699
carries C++ function signatures and other specifications
@@ -2755,8 +2756,8 @@ def __init__(
27552756
used to avoid problems with state variables that may become
27562757
negative due to numerical errors
27572758
2758-
:param compiler: distutils/setuptools compiler selection to build the
2759-
python extension
2759+
:param compiler: Absolute path to the compiler executable to be used
2760+
to build the Python extension, e.g. ``/usr/bin/clang``.
27602761
27612762
:param allow_reinit_fixpar_initcond:
27622763
see :class:`amici.de_export.DEExporter`
@@ -2876,8 +2877,8 @@ def _compile_c_code(
28762877
Make model compilation verbose
28772878
28782879
:param compiler:
2879-
distutils/setuptools compiler selection to build the python
2880-
extension
2880+
Absolute path to the compiler executable to be used to build the Python
2881+
extension, e.g. ``/usr/bin/clang``.
28812882
"""
28822883
# setup.py assumes it is run from within the model directory
28832884
module_dir = self.model_path
@@ -2900,8 +2901,10 @@ def _compile_c_code(
29002901
]
29012902
)
29022903

2904+
env = os.environ.copy()
29032905
if compiler is not None:
2904-
script_args.extend([f"--compiler={compiler}"])
2906+
# CMake will use the compiler specified in the CXX environment variable
2907+
env["CXX"] = compiler
29052908

29062909
# distutils.core.run_setup looks nicer, but does not let us check the
29072910
# result easily
@@ -2912,6 +2915,7 @@ def _compile_c_code(
29122915
stdout=subprocess.PIPE,
29132916
stderr=subprocess.STDOUT,
29142917
check=True,
2918+
env=env,
29152919
)
29162920
except subprocess.CalledProcessError as e:
29172921
print(e.output.decode("utf-8"))

python/sdist/amici/pysb_import.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ def pysb2amici(
112112
errors
113113
114114
:param compiler:
115-
distutils/setuptools compiler selection to build the python
116-
extension
115+
Absolute path to the compiler executable to be used to build the Python
116+
extension, e.g. ``/usr/bin/clang``.
117117
118118
:param compute_conservation_laws:
119119
if set to ``True``, conservation laws are automatically computed and

python/sdist/amici/sbml_import.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,8 @@ def sbml2amici(
365365
negative due to numerical errors
366366
367367
:param compiler:
368-
distutils/setuptools compiler selection to build the
369-
python extension
368+
Absolute path to the compiler executable to be used to build the Python
369+
extension, e.g. ``/usr/bin/clang``.
370370
371371
:param allow_reinit_fixpar_initcond:
372372
see :class:`amici.de_export.ODEExporter`

0 commit comments

Comments
 (0)