Skip to content

Commit

Permalink
Fix splipy.io optional imports
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBB committed Feb 13, 2024
1 parent ac28286 commit bc6c147
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions splipy/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,23 @@
from .stl import STL
from .ofoam import OpenFOAM

__all__ = ['G2', 'SVG', 'SPL', 'STL', 'OpenFOAM']

from importlib.util import find_spec


has_cv2 = find_spec('cv2')
has_rhino = find_spec('rhino3dm')


# GRDECL depends on optional cv2
has_grdecl = has_cv2
if has_cv2:
pass


# ThreeDM depends on optional rhino3dm
if has_rhino:
pass


__all__ = ['G2', 'SVG', 'SPL', 'STL', 'OpenFOAM']

if has_grdecl:
from .grdecl import GRDECL
__all__.append('GRDECL')


# ThreeDM depends on optional rhino3dm
has_rhino = find_spec('rhino3dm')
if has_rhino:
from .threedm import ThreeDM
__all__.append('ThreeDM')

0 comments on commit bc6c147

Please sign in to comment.