# HG changeset patch # User Edouard Tisserant # Date 1620812280 -7200 # Node ID fe819b4c62c0032fe8dd47a2bb670dcb9ef85559 # Parent 5243c2a2f7f8bd8b99a79f067a007b2263fdc8ae# Parent a81b72ef156cd4f23a0317c079c3f9948bbc46ba merged default in svghmi diff -r 5243c2a2f7f8 -r fe819b4c62c0 bacnet/bacnet.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") diff -r 5243c2a2f7f8 -r fe819b4c62c0 canfestival/canfestival.py --- 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 diff -r 5243c2a2f7f8 -r fe819b4c62c0 modbus/modbus.py --- 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") # diff -r 5243c2a2f7f8 -r fe819b4c62c0 util/paths.py --- 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) +