Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] update apps_layout.csv from EPSILON_APPS flag in make command #341

Open
wants to merge 2 commits into
base: upsilon-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading