From 51d5ed04d0c1daf997f7997867d5412f896755a6 Mon Sep 17 00:00:00 2001 From: AngeDieu <106985774+AngeDieu@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:31:05 +0200 Subject: [PATCH] [build] update apps_layout.csv from EPSILON_APPS flag in make command python approach --- apps/home/Makefile | 3 ++- apps/home/apps_layout.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/home/Makefile b/apps/home/Makefile index d23bcdc30f2..e696447ffab 100644 --- a/apps/home/Makefile +++ b/apps/home/Makefile @@ -17,12 +17,13 @@ i18n_files += $(call i18n_without_universal_for,home/base) SFLAGS += -I$(BUILD_DIR) apps_layout = apps/home/apps_layout.csv +apps_layout_list = $(foreach i, $${EPSILON_APPS}, $(if $(filter external, $(i)),,"$(i),")) $(eval $(call rule_for, \ APPS_LAYOUT, \ apps/home/apps_layout.cpp, \ , \ - $$(PYTHON) apps/home/apps_layout.py --layouts $(apps_layout) --header $$(subst .cpp,.h,$$@) --implementation $$@ --apps $$(EPSILON_APPS), \ + $$(PYTHON) apps/home/apps_layout.py --layouts $(apps_layout) --header $$(subst .cpp,.h,$$@) --implementation $$@ --apps $$(EPSILON_APPS) --apps_layout $(apps_layout_list), \ global \ )) diff --git a/apps/home/apps_layout.py b/apps/home/apps_layout.py index cff1f712b87..40a1f675543 100644 --- a/apps/home/apps_layout.py +++ b/apps/home/apps_layout.py @@ -12,9 +12,18 @@ parser.add_argument('--implementation', help='the .cpp file to generate') parser.add_argument('--apps', nargs='+', help='apps that are actually compiled') parser.add_argument('--layouts', help='the apps_layout.csv file') +parser.add_argument('--apps_layout', help='the apps_layout from the make command') args = parser.parse_args() +with io.open(args.layouts, "w", encoding="utf-8") as f: + ordered = args.apps_layout.split() + line1 = 'Default,'+','.join(ordered)+'\n' + line2 = 'HidePython,'+','.join(ordered)+'\n' + after = line1 + line2 + f.truncate() + f.write(after) + def build_permutation(apps, appsOrdered): res = [0] * len(apps) i = 0 @@ -29,6 +38,8 @@ def parse_config_file(layouts, apps): with io.open(layouts, "r", encoding="utf-8") as f: csvreader = csv.reader(f, delimiter=',') for row in csvreader: + for stg in row: + stg.strip() res['styles'].append(row[0]) res['permutations'].append(build_permutation(apps, row[1:])) return res