merged default in svghmi svghmi
authorEdouard Tisserant
Wed, 12 May 2021 11:38:00 +0200
branchsvghmi
changeset 3239 fe819b4c62c0
parent 3231 5243c2a2f7f8 (current diff)
parent 2736 a81b72ef156c (diff)
child 3240 5f756332ada1
merged default in svghmi
ProjectController.py
--- a/bacnet/bacnet.py	Thu Apr 15 09:15:23 2021 +0200
+++ b/bacnet/bacnet.py	Wed May 12 11:38:00 2021 +0200
@@ -38,9 +38,7 @@
 from ConfigTreeNode import ConfigTreeNode
 import util.paths as paths
 
-base_folder = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
-base_folder = os.path.join(base_folder, "..")
-BacnetPath  = os.path.join(base_folder, "BACnet")
+BacnetPath = paths.ThirdPartyPath("BACnet")
 BacnetLibraryPath = os.path.join(BacnetPath, "lib")
 BacnetIncludePath = os.path.join(BacnetPath, "include")
 BacnetIncludePortPath = os.path.join(BacnetPath, "ports")
--- a/canfestival/canfestival.py	Thu Apr 15 09:15:23 2021 +0200
+++ b/canfestival/canfestival.py	Wed May 12 11:38:00 2021 +0200
@@ -33,14 +33,14 @@
 from gnosis.xml.pickle.util import setParanoia  # pylint: disable=import-error
 
 import util.paths as paths
+
 from util.TranslationCatalogs import AddCatalog
 from ConfigTreeNode import ConfigTreeNode
 from PLCControler import \
     LOCATION_CONFNODE, \
     LOCATION_VAR_MEMORY
 
-base_folder = paths.AbsParentDir(__file__, 2)  # noqa
-CanFestivalPath = os.path.join(base_folder, "CanFestival-3")  # noqa
+CanFestivalPath = paths.ThirdPartyPath("CanFestival-3")  # noqa
 sys.path.append(os.path.join(CanFestivalPath, "objdictgen"))  # noqa
 
 # pylint: disable=wrong-import-position
--- a/modbus/modbus.py	Thu Apr 15 09:15:23 2021 +0200
+++ b/modbus/modbus.py	Wed May 12 11:38:00 2021 +0200
@@ -32,9 +32,7 @@
 from PLCControler import LOCATION_CONFNODE, LOCATION_VAR_MEMORY
 import util.paths as paths
 
-base_folder = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
-base_folder = os.path.join(base_folder, "..")
-ModbusPath = os.path.join(base_folder, "Modbus")
+ModbusPath = paths.ThirdPartyPath("Modbus")
 
 
 #
--- a/util/paths.py	Thu Apr 15 09:15:23 2021 +0200
+++ b/util/paths.py	Wed May 12 11:38:00 2021 +0200
@@ -28,7 +28,6 @@
 import sys
 from builtins import str as text
 
-
 def AbsFile(file):
     if isinstance(file, str):
         file = text(file, sys.getfilesystemencoding())
@@ -49,3 +48,10 @@
     for dummy in range(0, level):
         path = os.path.dirname(path)
     return path
+
+def ThirdPartyPath(name):
+    """
+    Return folder where to find sibling projects like Modbus, CanFestival, BACnet
+    """
+    return os.path.join(AbsParentDir(__file__, 2), name)
+