From f3cebeaa8956aeb31400b4e4d58cf9ecc54f8084 Mon Sep 17 00:00:00 2001 From: Jon Shimwell Date: Mon, 25 Nov 2024 11:23:34 +0100 Subject: [PATCH] concise platform suffix --- openmc/lib/__init__.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/openmc/lib/__init__.py b/openmc/lib/__init__.py index 9bb2efb38af..a6c7d447118 100644 --- a/openmc/lib/__init__.py +++ b/openmc/lib/__init__.py @@ -13,20 +13,12 @@ """ from ctypes import CDLL, c_bool, c_int -import importlib.resources import os -import sys -# Determine shared-library suffix -if sys.platform == 'darwin': - _suffix = 'dylib' -else: - _suffix = 'so' - if os.environ.get('READTHEDOCS', None) != 'True': - # Open shared library - _filename = importlib.resources.files(__name__) / f'libopenmc.{_suffix}' + import openmc + _filename = openmc.lib[0] _dll = CDLL(str(_filename)) # TODO: Remove str() when Python 3.12+ else: # For documentation builds, we don't actually have the shared library