lpcmanager

Parents 2fa14b7a29bd
Children 539325971a35
Override beremiz' util.paths.ThirdParty call to allow per-arch sub-directories in fieldbus stacks
--- a/LPCExtension.py Mon Apr 19 15:16:43 2021 +0200
+++ b/LPCExtension.py Wed May 12 10:40:32 2021 +0200
@@ -8,9 +8,9 @@
import features
from POULibrary import SimplePOULibraryFactory
-from LPCArch import GetLPCProduct, GetLPCSOM, MC9_modules, WX_GOT_modules, SVG_GOT_modules
+from LPCArch import GetLPCProduct, GetLPCSOM, MC9_modules, WX_GOT_modules, SVG_GOT_modules, GetLPCArch
-# _lpcmanager_path, arch, etc are defined here because
+# _lpcmanager_path, arch, etc are defined here because
# globals() of LPCManager.py are passed to extentions
wanted_features_names = ["c_ext", "py_ext"]
@@ -82,7 +82,7 @@
"class": targets.targets["Xenomai"]["class"],
"code": {"plc_"+som+"_main.c": targets.targets["Xenomai"]["code"]["plc_Xenomai_main.c"],
"plc_"+som+"_main_retain.c": os.path.join(_lpcmanager_path,
- som+"target",
+ som+"target",
"plc_"+som+"_main_retain.c")}}}
else:
raise NotImplemented
@@ -108,7 +108,7 @@
# ----- on load options and OnChange colums fix --------
#
-from py_ext.PythonFileCTNMixin import PythonFileCTNMixin
+from py_ext.PythonFileCTNMixin import PythonFileCTNMixin
from OnChangeFromOptions import GetVarOnChangeContent, FixOptions
PythonFileCTNMixin.GetVarOnChangeContent = GetVarOnChangeContent
@@ -120,6 +120,19 @@
PythonFileCTNMixin.__init__ = PythonFileCTNMixin__init__with_FixOptions
+#
+# ------- select pre-built stack according to SOM -------
+#
+import util.paths as paths
+arch = GetLPCArch()
+old_ThirdPartyPath = paths.ThirdPartyPath
+def ThirdPartyPath(name):
+ res = old_ThirdPartyPath(name)
+ if name in ["BACnet", "Modbus", "CanFestival-3"]:
+ res = os.path.join(res, arch)
+ return res
+paths.ThirdPartyPath = ThirdPartyPath
+