refactor(ipm): move simple_refrig_api into app.ipm and update loader; ignore native binaries
This commit is contained in:
@@ -7,13 +7,21 @@ import os
|
||||
from pathlib import Path
|
||||
from typing import Dict, Optional, List
|
||||
|
||||
# Ajouter le repertoire IPM_DLL au path pour importer simple_refrig_api
|
||||
_current_dir = Path(__file__).parent.parent.parent
|
||||
_ipm_dll_dir = _current_dir / "IPM_DLL"
|
||||
if str(_ipm_dll_dir) not in sys.path:
|
||||
sys.path.insert(0, str(_ipm_dll_dir))
|
||||
|
||||
from simple_refrig_api import Refifc
|
||||
# Prefer the packaged app.ipm module, but keep a fallback to the legacy
|
||||
# IPM_DLL folder for development compatibility.
|
||||
try:
|
||||
from app.ipm.simple_refrig_api import Refifc, MockRefifc # type: ignore
|
||||
except Exception:
|
||||
# Fall back to loading from IPM_DLL directory as before. Import the
|
||||
# module and pick attributes if present; older legacy wrappers may not
|
||||
# define MockRefifc.
|
||||
_current_dir = Path(__file__).parent.parent.parent
|
||||
_ipm_dll_dir = _current_dir / "IPM_DLL"
|
||||
if str(_ipm_dll_dir) not in sys.path:
|
||||
sys.path.insert(0, str(_ipm_dll_dir))
|
||||
import simple_refrig_api as _sr # type: ignore
|
||||
Refifc = getattr(_sr, 'Refifc')
|
||||
MockRefifc = getattr(_sr, 'MockRefifc', None)
|
||||
|
||||
|
||||
class RefrigerantLibrary:
|
||||
|
||||
Reference in New Issue
Block a user