From bfee89637845fc9143f104a2c5a775cba201112f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 23 Oct 2018 22:27:18 +0300 Subject: [PATCH] Cache loaded project config --- platformio/util.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/platformio/util.py b/platformio/util.py index d05b6d34..2c05f747 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -334,12 +334,8 @@ def get_projectdata_dir(): "data")) -def load_project_config(path=None): - if not path or isdir(path): - path = join(path or get_project_dir(), "platformio.ini") - if not isfile(path): - raise exception.NotPlatformIOProject( - dirname(path) if path.endswith("platformio.ini") else path) +@memoized() +def _load_project_config(path): cp = ProjectConfig() try: cp.read(path) @@ -348,6 +344,15 @@ def load_project_config(path=None): return cp +def load_project_config(path=None): + if not path or isdir(path): + path = join(path or get_project_dir(), "platformio.ini") + if not isfile(path): + raise exception.NotPlatformIOProject( + dirname(path) if path.endswith("platformio.ini") else path) + return _load_project_config(path) + + def parse_conf_multi_values(items): result = [] if not items: