Commit 8e7e6e94 authored by Baptiste Durand's avatar Baptiste Durand

Separation of the imports of the different sub-modules.Even if fenics is not...

Separation of the imports of the different sub-modules.Even if fenics is not installed, the mesh/geometry functionalities (gmsh) can be used.
parent ad968fb6
...@@ -10,10 +10,6 @@ from pathlib import Path ...@@ -10,10 +10,6 @@ from pathlib import Path
__version__ = "0.1" __version__ = "0.1"
GEO_TOLERANCE = 1e-12
from . import geometry, materials, periodicity
from . import full_scale_pb, homog2d, mesh_generate, mesh_tools, part, toolbox_FEniCS
log_level = logging.DEBUG log_level = logging.DEBUG
log_path = Path("~/ho_homog_log/activity.log").expanduser() log_path = Path("~/ho_homog_log/activity.log").expanduser()
...@@ -26,6 +22,32 @@ formatter = logging.Formatter( ...@@ -26,6 +22,32 @@ formatter = logging.Formatter(
) )
GEO_TOLERANCE = 1e-12
try:
from . import geometry, mesh_tools, mesh_generate
except ImportError:
pckg_logger.warning("Import of geometry and mesh generating submodules fails")
try:
from . import materials
except ImportError:
pckg_logger.warning("Import of material submodule fails")
try:
from . import periodicity
except ImportError:
pckg_logger.warning("Import of periodicity submodule fails")
try:
from . import full_scale_pb, homog2d, part, toolbox_FEniCS
except ImportError:
pckg_logger.warning("One of the following submodule imports fails : full_scale_pb, homog2d, part, toolbox_FEniCS")
def set_log_handlers(level: int = log_level, path=log_path): def set_log_handlers(level: int = log_level, path=log_path):
"""Should be run if log_path or log_level is changed.""" """Should be run if log_path or log_level is changed."""
file_handler = RotatingFileHandler(str(log_path), "a", 10000000, 10) file_handler = RotatingFileHandler(str(log_path), "a", 10000000, 10)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment