diff --git a/sw/ground_segment/python/settings_app/settingsapp.py b/sw/ground_segment/python/settings_app/settingsapp.py index 9f7eae3080c..16c36006f45 100755 --- a/sw/ground_segment/python/settings_app/settingsapp.py +++ b/sw/ground_segment/python/settings_app/settingsapp.py @@ -7,7 +7,9 @@ import getopt import sys -sys.path.append(os.getenv("PAPARAZZI_HOME") + "/sw/lib/python") +PPRZ_SRC = os.getenv("PAPARAZZI_SRC", os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), + '../../../..'))) +sys.path.append(PPRZ_SRC + "/sw/lib/python") import settings_xml_parse def Usage(scmd): diff --git a/sw/ground_segment/python/settings_app/settingsframe.py b/sw/ground_segment/python/settings_app/settingsframe.py index ce0d7e14fe8..65f775703b2 100644 --- a/sw/ground_segment/python/settings_app/settingsframe.py +++ b/sw/ground_segment/python/settings_app/settingsframe.py @@ -6,7 +6,9 @@ import sys import os -sys.path.append(os.getenv("PAPARAZZI_HOME") + "/sw/lib/python") +PPRZ_SRC = os.getenv("PAPARAZZI_SRC", os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), + '../../../..'))) +sys.path.append(PPRZ_SRC + "/sw/lib/python") from settings_tool import IvySettingsInterface diff --git a/sw/lib/python/settings_tool.py b/sw/lib/python/settings_tool.py index 6e8b313911d..6be73172b92 100755 --- a/sw/lib/python/settings_tool.py +++ b/sw/lib/python/settings_tool.py @@ -7,7 +7,9 @@ import logging import sys -sys.path.append(os.getenv("PAPARAZZI_HOME") + "/sw/lib/python") +PPRZ_SRC = os.getenv("PAPARAZZI_SRC", os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), + '../../..'))) +sys.path.append(PPRZ_SRC + "/sw/lib/python") from settings_xml_parse import PaparazziACSettings _SHOW_IVY_MSGS_ = False diff --git a/sw/lib/python/settings_xml_parse.py b/sw/lib/python/settings_xml_parse.py index 5f2602221c5..151ef3f7b6e 100755 --- a/sw/lib/python/settings_xml_parse.py +++ b/sw/lib/python/settings_xml_parse.py @@ -6,6 +6,10 @@ import sys from lxml import etree +# if PAPARAZZI_HOME not set, then assume the tree containing this +# file is a reasonable substitute +PPRZ_HOME = os.getenv("PAPARAZZI_HOME", os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), + '../../..'))) # Class for all settings class PaparazziACSettings: "Paparazzi Settings Class" @@ -18,7 +22,7 @@ class PaparazziACSettings: def __init__(self, ac_id): self.ac_id = ac_id - paparazzi_home = os.getenv("PAPARAZZI_HOME") + paparazzi_home = PPRZ_HOME paparazzi_conf = os.path.join(paparazzi_home, 'conf') conf_xml_path = os.path.join(paparazzi_conf, 'conf.xml') conf_tree = etree.parse(conf_xml_path)