mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Remove use of pkg_resources package (#3069)
This commit is contained in:
parent
fd47df4bb2
commit
32440ad203
3 changed files with 6 additions and 8 deletions
|
|
@ -13,11 +13,10 @@ functions or objects in :mod:`openmc.lib`, for example:
|
|||
"""
|
||||
|
||||
from ctypes import CDLL, c_bool, c_int
|
||||
import importlib.resources
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pkg_resources
|
||||
|
||||
|
||||
# Determine shared-library suffix
|
||||
if sys.platform == 'darwin':
|
||||
|
|
@ -27,9 +26,8 @@ else:
|
|||
|
||||
if os.environ.get('READTHEDOCS', None) != 'True':
|
||||
# Open shared library
|
||||
_filename = pkg_resources.resource_filename(
|
||||
__name__, f'libopenmc.{_suffix}')
|
||||
_dll = CDLL(_filename)
|
||||
_filename = importlib.resources.files(__name__) / f'libopenmc.{_suffix}'
|
||||
_dll = CDLL(str(_filename)) # TODO: Remove str() when Python 3.12+
|
||||
else:
|
||||
# For documentation builds, we don't actually have the shared library
|
||||
# available. Instead, we create a mock object so that when the modules
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ docs = [
|
|||
"sphinxcontrib-svg2pdfconverter",
|
||||
"sphinx-rtd-theme==1.0.0"
|
||||
]
|
||||
test = ["pytest", "pytest-cov", "colorama", "openpyxl"]
|
||||
test = ["packaging", "pytest", "pytest-cov", "colorama", "openpyxl"]
|
||||
vtk = ["vtk"]
|
||||
|
||||
[project.urls]
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import numpy as np
|
||||
import openmc
|
||||
from pkg_resources import parse_version
|
||||
from packaging.version import parse
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(scope='module', autouse=True)
|
||||
def numpy_version_requirement():
|
||||
assert parse_version(np.__version__) >= parse_version("1.14"), \
|
||||
assert parse(np.__version__) >= parse("1.14"), \
|
||||
"Regression tests require NumPy 1.14 or greater"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue