diff --git a/python/amici/__init__.py b/python/amici/__init__.py index 97de3323b7..a57e36c3de 100644 --- a/python/amici/__init__.py +++ b/python/amici/__init__.py @@ -63,6 +63,7 @@ def _imported_from_setup() -> bool: """Check whether this module is imported from `setup.py`""" from inspect import getouterframes, currentframe + from os import sep # in case we are imported from setup.py, this will be the AMICI package # root directory (otherwise it is most likely the Python library directory, @@ -75,7 +76,9 @@ def _imported_from_setup() -> bool: # requires the AMICI extension during its installation, but seems # unlikely... frame_path = os.path.realpath(os.path.expanduser(frame.filename)) - if frame_path == os.path.join(package_root, 'setup.py'): + if (frame_path == os.path.join(package_root, 'setup.py') + or frame_path.endswith(f"{sep}setuptools{sep}build_meta.py") + ): return True return False