Skip to content

Commit

Permalink
[build] update apps_layout.csv from EPSILON_APPS flag in make command
Browse files Browse the repository at this point in the history
python approach
  • Loading branch information
AngeDieu committed Jul 13, 2023
1 parent a945fc1 commit 51d5ed0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/home/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
))

Expand Down
11 changes: 11 additions & 0 deletions apps/home/apps_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 51d5ed0

Please sign in to comment.