diff --git a/plinth/cfg.py b/plinth/cfg.py index cc2538189..b2ad72b42 100644 --- a/plinth/cfg.py +++ b/plinth/cfg.py @@ -53,9 +53,8 @@ config_files = [] def get_develop_config_path(): """Return config path of current source folder for development mode.""" root_directory = os.path.dirname(os.path.realpath(__file__)) - root_directory = os.path.join(root_directory, '..') root_directory = os.path.realpath(root_directory) - config_path = os.path.join(root_directory, 'plinth.config') + config_path = os.path.join(root_directory, 'develop.config') return config_path @@ -79,9 +78,13 @@ def read_file(config_path): # Keep a note of configuration files read. config_files.append(config_path) - parser = configparser.ConfigParser(defaults={ - 'parent_dir': pathlib.Path(config_path).parent.resolve(), - }) + parser = configparser.ConfigParser( + defaults={ + 'parent_dir': + pathlib.Path(config_path).parent.resolve(), + 'parent_parent_dir': + pathlib.Path(config_path).parent.parent.resolve(), + }) parser.read(config_path) config_items = ( diff --git a/plinth.config b/plinth/develop.config similarity index 96% rename from plinth.config rename to plinth/develop.config index 8b21b06d6..2c0791032 100644 --- a/plinth.config +++ b/plinth/develop.config @@ -1,6 +1,6 @@ [Path] # directory locations -file_root = %(parent_dir)s +file_root = %(parent_parent_dir)s config_dir = %(file_root)s/data/etc/plinth data_dir = %(file_root)s/data/var/lib/plinth server_dir = /plinth diff --git a/plinth/tests/test_cfg.py b/plinth/tests/test_cfg.py index d4ea490dd..922a22354 100644 --- a/plinth/tests/test_cfg.py +++ b/plinth/tests/test_cfg.py @@ -54,7 +54,8 @@ def test_read_develop_config_file(): """Verify that the correct develop config file is used.""" test_dir = os.path.dirname(os.path.realpath(__file__)) develop_root = os.path.realpath(os.path.join(test_dir, '..', '..')) - develop_config_file = os.path.join(develop_root, 'plinth.config') + develop_config_file = os.path.join(develop_root, 'plinth', + 'develop.config') config_path = cfg.get_develop_config_path() cfg.read_file(config_path) assert cfg.config_files[-1] == develop_config_file