|
| 1 | +--- a/rebound/__init__.py 2026-07-02 13:22:12.265323563 +0200 |
| 2 | ++++ b/rebound/__init__.py 2026-07-02 13:30:16.171832835 +0200 |
| 3 | +@@ -29,13 +29,23 @@ |
| 4 | + except: |
| 5 | + pass |
| 6 | + |
| 7 | +-# Import shared library |
| 8 | +-spec = importlib.util.find_spec("librebound") |
| 9 | +-if spec and spec.origin: |
| 10 | +- __libpath__ = spec.origin |
| 11 | ++# Import shared library. |
| 12 | ++# On emscripten, librebound is installed as a standalone shared library |
| 13 | ++# in the conda prefix (not as a Python extension module in site-packages). |
| 14 | ++# Load it directly from there. Use a fixed ".so" suffix because the |
| 15 | ++# library is built without Python ABI tags. |
| 16 | ++if sys.platform == "emscripten": |
| 17 | ++ import sysconfig as _sysconfig |
| 18 | ++ _prefix = _sysconfig.get_path("data") |
| 19 | ++ __libpath__ = os.path.join(_prefix, "lib", "librebound.so") |
| 20 | + clibrebound = cdll.LoadLibrary(__libpath__) |
| 21 | + else: |
| 22 | +- raise ImportError("librebound not found") |
| 23 | ++ spec = importlib.util.find_spec("librebound") |
| 24 | ++ if spec and spec.origin: |
| 25 | ++ __libpath__ = spec.origin |
| 26 | ++ clibrebound = cdll.LoadLibrary(__libpath__) |
| 27 | ++ else: |
| 28 | ++ raise ImportError("librebound not found") |
| 29 | + |
| 30 | + # Version |
| 31 | + __version__ = c_char_p.in_dll(clibrebound, "reb_version_str").value.decode('ascii') |
0 commit comments