8000 Make CIRCUITPY_LOCALIZE a per-board setting by jepler · Pull Request #8628 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

Make CIRCUITPY_LOCALIZE a per-board setting #8628

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

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 4 additions & 1 deletion docs/shared_bindings_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def get_settings_from_makefile(port_dir, board_name):
This list must explicitly include any setting queried by tools/ci_set_matrix.py.
"""
contents = subprocess.run(
["make", "-C", port_dir, "-f", "Makefile", f"BOARD={board_name}", "print-CFLAGS", "print-CIRCUITPY_BUILD_EXTENSIONS", "print-FROZEN_MPY_DIRS", "print-SRC_PATTERNS", "print-SRC_SUPERVISOR"],
["make", "-C", port_dir, "-f", "Makefile", f"BOARD={board_name}", "print-CFLAGS", "print-CIRCUITPY_BUILD_EXTENSIONS", "print-CIRCUITPY_LOCALIZE", "print-FROZEN_MPY_DIRS", "print-SRC_PATTERNS", "print-SRC_SUPERVISOR"],
encoding="utf-8",
errors="replace",
stdout=subprocess.PIPE,
Expand Down Expand Up @@ -328,6 +328,7 @@ def support_matrix(arg):
else:
raise OSError(f"Board extensions undefined: {board_name}.")


frozen_modules = []
if "FROZEN_MPY_DIRS" in settings:
frozen_modules = frozen_modules_from_dirs(
Expand All @@ -344,6 +345,7 @@ def support_matrix(arg):
"modules": board_modules,
"frozen_libraries": frozen_modules,
"extensions": board_extensions,
"localize": int(settings["CIRCUITPY_LOCALIZE"])
},
)
]
Expand All @@ -361,6 +363,7 @@ def support_matrix(arg):
"modules": board_modules,
"frozen_libraries": frozen_modules,
"extensions": board_extensions,
"localize": int(settings["CIRCUITPY_LOCALIZE"])
},
)
)
Expand Down
3 changes: 3 additions & 0 deletions ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ CIRCUITPY_TOUCHIO = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_USB_HID = 0

# Board doesn't have enough flash space to support localization
CIRCUITPY_LOCALIZE = 0

# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM69
5 changes: 5 additions & 0 deletions py/circuitpy_mpconfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ CFLAGS += -DCIRCUITPY=$(CIRCUITPY)
CIRCUITPY_FULL_BUILD ?= 1
CFLAGS += -DCIRCUITPY_FULL_BUILD=$(CIRCUITPY_FULL_BUILD)

# Smaller builds may not have enough room for non-English translations. This
# flag stops the CI from building them. It does NOT appear in CFLAGS and cannot
# be tested by the C preprocessor.
CIRCUITPY_LOCALIZE ?= 1

# By default, aggressively reduce the size of in-flash messages, at the cost of
# increased build time
CIRCUITPY_MESSAGE_COMPRESSION_LEVEL ?= 9
Expand Down
11 changes: 7 additions & 4 deletions tools/build_board_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ def print_active_user():
response = github.get("/user")
if response.ok:
user = response.json()["login"]
print("Logged in as {}".format(user))
print("Logged in as {}".format(user), file=sys.stderr)
return user
else:
print("Not logged in")
print("Not logged in", file=sys.stderr)
return None


Expand Down Expand Up @@ -237,13 +237,16 @@ def generate_download_info():
board_info = board_mapping[board_id]
for alias in [board_id] + board_info["aliases"]:
alias_info = board_mapping[alias]
board_languages = (
"languages" if support_matrix[alias]["localize"] else ["en_US"]
)
if alias not in current_info:
changes["new_boards"].append(alias)
current_info[alias] = {"downloads": 0, "versions": []}
new_version = {
"stable": new_stable,
"version": new_tag,
"languages": languages,
"languages": board_languages,
# add modules, extensions, frozen_libraries explicitly
"modules": support_matrix[alias]["modules"],
"extensions": support_matrix[alias]["extensions"],
Expand All @@ -264,7 +267,7 @@ def generate_download_info():


if __name__ == "__main__":
if "RELEASE_TAG" in os.environ and os.environ["RELEASE_TAG"]:
if os.environ.get("RELEASE_TAG") or os.environ.get("DEBUG"):
generate_download_info()
else:
print("skipping website update because this isn't a tag")
11 changes: 5 additions & 6 deletions tools/build_release_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
for port in build_info.SUPPORTED_PORTS:
result = subprocess.run("rm -rf ../ports/{port}/build*".format(port=port), shell=True)

PARALLEL = "-j 4"
if "GITHUB_ACTION" in os.environ:
PARALLEL = "-j 2"

all_boards = build_info.get_board_mapping()
build_boards = list(all_boards.keys())
if "BOARDS" in os.environ:
Expand All @@ -36,6 +32,8 @@
LANGUAGE_THRESHOLD = 10 * 1024

languages = build_info.get_languages()
languages.remove(LANGUAGE_FIRST)
languages.insert(0, LANGUAGE_FIRST)

all_languages = build_info.get_languages(list_all=True)

Expand All @@ -50,8 +48,9 @@
board_info = all_boards[board]
board_settings = get_settings_from_makefile("../ports/" + board_info["port"], board)

languages.remove(LANGUAGE_FIRST)
languages.insert(0, LANGUAGE_FIRST)
localize = int(board_settings["CIRCUITPY_LOCALIZE"])
board_languages = languages if localize else ["en_US"]
print(f"{board}: Building languages:", ", ".join(board_languages))

for language in languages:
bin_directory = "../bin/{board}/{language}".format(board=board, language=language)
Expand Down
0