Skip to content

Implement issue #4470 #4483

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

Merged
merged 2 commits into from
Mar 25, 2021
Merged
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
43 changes: 33 additions & 10 deletions tools/build_board_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,32 @@
"pewpew10": ["pewpew13"],
}


def get_languages():
languages = []
language_allow_list = set([
"ID",
"de_DE",
"en_US",
"en_x_pirate",
"es",
"fil",
"fr",
"it_IT",
"ja",
"nl",
"pl",
"pt_BR",
"sv",
"zh_Latn_pinyin",
])


def get_languages(list_all = False):
languages = set()
for f in os.scandir("../locale"):
if f.name.endswith(".po"):
languages.append(f.name[:-3])
return languages
languages.add(f.name[:-3])
if not list_all:
languages = languages & language_allow_list
return sorted(list(languages), key = lambda s: s.casefold())


def get_board_mapping():
Expand Down Expand Up @@ -163,20 +182,23 @@ def get_current_info():
return git_info, current_info


def create_pr(changes, updated, git_info, user):
commit_sha, original_blob_sha = git_info
branch_name = "new_release_" + changes["new_release"]

def create_json(updated):
# Convert the dictionary to a list of boards. Liquid templates only handle arrays.
updated_list = []
all_ids = sorted(updated.keys())
for id in all_ids:
info = updated[id]
info["id"] = id
updated_list.append(info)
return json.dumps(updated_list, sort_keys=True, indent=1).encode("utf-8") + b"\n"

updated = json.dumps(updated_list, sort_keys=True, indent=1).encode("utf-8") + b"\n"

def create_pr(changes, updated, git_info, user):
commit_sha, original_blob_sha = git_info
branch_name = "new_release_" + changes["new_release"]
updated = create_json(updated)
# print(updated.decode("utf-8"))

pr_title = "Automated website update for release {}".format(changes["new_release"])
boards = ""
if changes["new_boards"]:
Expand Down Expand Up @@ -302,6 +324,7 @@ def generate_download_info():
create_pr(changes, current_info, git_info, user)
else:
print("No new release to update")
# print(create_json(current_info).decode("utf8"))


if __name__ == "__main__":
Expand Down
23 changes: 5 additions & 18 deletions tools/build_release_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,10 @@
sha, version = build_info.get_version_info()

languages = build_info.get_languages()
language_allow_list = [
"ID",
"de_DE",
"en_US",
"en_x_pirate",
"es",
"fil",
"fr",
"it_IT",
"ja",
"nl",
"pl",
"pt_BR",
"sv",
"zh_Latn_pinyin",
]
print("Note: Not building languages", set(languages) - set(language_allow_list))

all_languages = build_info.get_languages(list_all=True)

print("Note: Not building languages", set(all_languages) - set(languages))

exit_status = 0
cores = multiprocessing.cpu_count()
Expand All @@ -53,7 +40,7 @@
os.makedirs(bin_directory, exist_ok=True)
board_info = all_boards[board]

for language in language_allow_list:
for language in languages:
bin_directory = "../bin/{board}/{language}".format(board=board, language=language)
os.makedirs(bin_directory, exist_ok=True)
start_time = time.monotonic()
Expand Down