Merge remote-tracking branch 'adafruit/main' into sleep
This commit is contained in:
commit
cd436bad1a
|
@ -7,7 +7,7 @@ msgstr ""
|
|||
"Project-Id-Version: circuitpython-cn\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-11-10 15:30+0530\n"
|
||||
"PO-Revision-Date: 2020-11-15 16:28+0000\n"
|
||||
"PO-Revision-Date: 2020-11-19 01:28+0000\n"
|
||||
"Last-Translator: hexthat <hexthat@gmail.com>\n"
|
||||
"Language-Team: Chinese Hanyu Pinyin\n"
|
||||
"Language: zh_Latn_pinyin\n"
|
||||
|
@ -1012,7 +1012,7 @@ msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè"
|
|||
|
||||
#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "Initialization failed due to lack of memory"
|
||||
msgstr ""
|
||||
msgstr "yóu yú nèi cún bù zú, chū shǐ huà shī bài"
|
||||
|
||||
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
|
||||
msgid "Input taking too long"
|
||||
|
@ -3661,7 +3661,7 @@ msgstr "xiàngliàng bìxū jùyǒu xiāngtóng de chángdù"
|
|||
|
||||
#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c
|
||||
msgid "watchdog not initialized"
|
||||
msgstr ""
|
||||
msgstr "wèi chū shǐ huà jiān shì qì"
|
||||
|
||||
#: shared-bindings/watchdog/WatchDogTimer.c
|
||||
msgid "watchdog timeout must be greater than 0"
|
||||
|
|
|
@ -98,8 +98,12 @@ void reset_to_bootloader(void) {
|
|||
}
|
||||
}
|
||||
|
||||
supervisor_allocation _fixed_stack;
|
||||
|
||||
supervisor_allocation* port_fixed_stack(void) {
|
||||
return NULL;
|
||||
_fixed_stack.ptr = port_stack_get_limit();
|
||||
_fixed_stack.length = (port_stack_get_top() - port_stack_get_limit()) * sizeof(uint32_t);
|
||||
return &_fixed_stack;
|
||||
}
|
||||
|
||||
uint32_t *port_stack_get_limit(void) {
|
||||
|
|
|
@ -83,7 +83,8 @@ bool displayio_palette_get_color(displayio_palette_t *self, const _displayio_col
|
|||
uint8_t pixel_hue = self->colors[palette_index].hue;
|
||||
displayio_colorconverter_compute_tricolor(colorspace, pixel_hue, luma, color);
|
||||
} else if (colorspace->grayscale) {
|
||||
*color = self->colors[palette_index].luma >> (8 - colorspace->depth);
|
||||
size_t bitmask = (1 << colorspace->depth) - 1;
|
||||
*color = (self->colors[palette_index].luma >> colorspace->grayscale_bit) & bitmask;
|
||||
} else {
|
||||
uint16_t packed = self->colors[palette_index].rgb565;
|
||||
if (colorspace->reverse_bytes_in_word) {
|
||||
|
|
|
@ -19,20 +19,24 @@ import shared_bindings_matrix
|
|||
sys.path.append("adabot")
|
||||
import adabot.github_requests as github
|
||||
|
||||
SUPPORTED_PORTS = ["atmel-samd", "cxd56", "esp32s2", "litex", "mimxrt10xx", "nrf", "stm"]
|
||||
SUPPORTED_PORTS = [
|
||||
"atmel-samd",
|
||||
"cxd56",
|
||||
"esp32s2",
|
||||
"litex",
|
||||
"mimxrt10xx",
|
||||
"nrf",
|
||||
"stm",
|
||||
]
|
||||
|
||||
BIN = ('bin',)
|
||||
UF2 = ('uf2',)
|
||||
BIN_UF2 = ('bin', 'uf2')
|
||||
HEX = ('hex',)
|
||||
HEX_UF2 = ('hex', 'uf2')
|
||||
SPK = ('spk',)
|
||||
DFU = ('dfu',)
|
||||
BIN_DFU = ('bin', 'dfu')
|
||||
|
||||
# Example:
|
||||
# https://downloads.circuitpython.org/bin/trinket_m0/en_US/adafruit-circuitpython-trinket_m0-en_US-5.0.0-rc.0.uf2
|
||||
DOWNLOAD_BASE_URL = "https://downloads.circuitpython.org/bin"
|
||||
BIN = ("bin",)
|
||||
UF2 = ("uf2",)
|
||||
BIN_UF2 = ("bin", "uf2")
|
||||
HEX = ("hex",)
|
||||
HEX_UF2 = ("hex", "uf2")
|
||||
SPK = ("spk",)
|
||||
DFU = ("dfu",)
|
||||
BIN_DFU = ("bin", "dfu")
|
||||
|
||||
# Default extensions
|
||||
extension_by_port = {
|
||||
|
@ -42,7 +46,7 @@ extension_by_port = {
|
|||
"cxd56": SPK,
|
||||
"mimxrt10xx": HEX_UF2,
|
||||
"litex": DFU,
|
||||
"esp32s2": BIN_UF2
|
||||
"esp32s2": BIN_UF2,
|
||||
}
|
||||
|
||||
# Per board overrides
|
||||
|
@ -57,26 +61,28 @@ extension_by_board = {
|
|||
"feather_m0_rfm69": BIN_UF2,
|
||||
"feather_m0_rfm9x": BIN_UF2,
|
||||
"uchip": BIN_UF2,
|
||||
|
||||
# nRF52840 dev kits that may not have UF2 bootloaders,
|
||||
"makerdiary_nrf52840_mdk": HEX,
|
||||
"makerdiary_nrf52840_mdk_usb_dongle": HEX_UF2,
|
||||
"pca10056": BIN_UF2,
|
||||
"pca10059": BIN_UF2,
|
||||
"electronut_labs_blip": HEX,
|
||||
|
||||
# stm32
|
||||
"meowbit_v121": UF2
|
||||
"meowbit_v121": UF2,
|
||||
}
|
||||
|
||||
aliases_by_board = {
|
||||
"circuitplayground_express": ["circuitplayground_express_4h", "circuitplayground_express_digikey_pycon2019"],
|
||||
"circuitplayground_express": [
|
||||
"circuitplayground_express_4h",
|
||||
"circuitplayground_express_digikey_pycon2019",
|
||||
],
|
||||
"pybadge": ["edgebadge"],
|
||||
"pyportal": ["pyportal_pynt"],
|
||||
"gemma_m0": ["gemma_m0_pycon2018"],
|
||||
"pewpew10": ["pewpew13"]
|
||||
"pewpew10": ["pewpew13"],
|
||||
}
|
||||
|
||||
|
||||
def get_languages():
|
||||
languages = []
|
||||
for f in os.scandir("../locale"):
|
||||
|
@ -84,6 +90,7 @@ def get_languages():
|
|||
languages.append(f.name[:-3])
|
||||
return languages
|
||||
|
||||
|
||||
def get_board_mapping():
|
||||
boards = {}
|
||||
for port in SUPPORTED_PORTS:
|
||||
|
@ -95,23 +102,30 @@ def get_board_mapping():
|
|||
extensions = extension_by_port[port]
|
||||
extensions = extension_by_board.get(board_path.name, extensions)
|
||||
aliases = aliases_by_board.get(board_path.name, [])
|
||||
boards[board_id] = {"port": port,
|
||||
"extensions": extensions,
|
||||
"download_count": 0,
|
||||
"aliases": aliases}
|
||||
boards[board_id] = {
|
||||
"port": port,
|
||||
"extensions": extensions,
|
||||
"download_count": 0,
|
||||
"aliases": aliases,
|
||||
}
|
||||
for alias in aliases:
|
||||
boards[alias] = {"port": port,
|
||||
"extensions": extensions,
|
||||
"download_count": 0,
|
||||
"alias": True,
|
||||
"aliases": []}
|
||||
boards[alias] = {
|
||||
"port": port,
|
||||
"extensions": extensions,
|
||||
"download_count": 0,
|
||||
"alias": True,
|
||||
"aliases": [],
|
||||
}
|
||||
return boards
|
||||
|
||||
|
||||
def get_version_info():
|
||||
version = None
|
||||
sha = git("rev-parse", "--short", "HEAD").stdout.decode("utf-8")
|
||||
try:
|
||||
version = git("describe", "--tags", "--exact-match").stdout.decode("utf-8").strip()
|
||||
version = (
|
||||
git("describe", "--tags", "--exact-match").stdout.decode("utf-8").strip()
|
||||
)
|
||||
except sh.ErrorReturnCode_128:
|
||||
# No exact match
|
||||
pass
|
||||
|
@ -120,10 +134,11 @@ def get_version_info():
|
|||
sha = os.environ["GITHUB_SHA"]
|
||||
|
||||
if not version:
|
||||
version="{}-{}".format(date.today().strftime("%Y%m%d"), sha[:7])
|
||||
version = "{}-{}".format(date.today().strftime("%Y%m%d"), sha[:7])
|
||||
|
||||
return sha, version
|
||||
|
||||
|
||||
def get_current_info():
|
||||
response = github.get("/repos/adafruit/circuitpython-org/git/refs/heads/master")
|
||||
if not response.ok:
|
||||
|
@ -131,7 +146,9 @@ def get_current_info():
|
|||
raise RuntimeError("cannot get master sha")
|
||||
commit_sha = response.json()["object"]["sha"]
|
||||
|
||||
response = github.get("/repos/adafruit/circuitpython-org/contents/_data/files.json?ref=" + commit_sha)
|
||||
response = github.get(
|
||||
"/repos/adafruit/circuitpython-org/contents/_data/files.json?ref=" + commit_sha
|
||||
)
|
||||
if not response.ok:
|
||||
print(response.text)
|
||||
raise RuntimeError("cannot get previous files.json")
|
||||
|
@ -145,6 +162,7 @@ def get_current_info():
|
|||
current_info[info["id"]] = 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"]
|
||||
|
@ -158,7 +176,7 @@ def create_pr(changes, updated, git_info, user):
|
|||
updated_list.append(info)
|
||||
|
||||
updated = json.dumps(updated_list, sort_keys=True, indent=1).encode("utf-8") + b"\n"
|
||||
#print(updated.decode("utf-8"))
|
||||
# print(updated.decode("utf-8"))
|
||||
pr_title = "Automated website update for release {}".format(changes["new_release"])
|
||||
boards = ""
|
||||
if changes["new_boards"]:
|
||||
|
@ -167,16 +185,13 @@ def create_pr(changes, updated, git_info, user):
|
|||
if changes["new_languages"]:
|
||||
languages = "New languages:\n* " + "\n* ".join(changes["new_languages"])
|
||||
message = "Automated website update for release {} by Blinka.\n\n{}\n\n{}\n".format(
|
||||
changes["new_release"],
|
||||
boards,
|
||||
languages
|
||||
changes["new_release"], boards, languages
|
||||
)
|
||||
|
||||
create_branch = {
|
||||
"ref": "refs/heads/" + branch_name,
|
||||
"sha": commit_sha
|
||||
}
|
||||
response = github.post("/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch)
|
||||
create_branch = {"ref": "refs/heads/" + branch_name, "sha": commit_sha}
|
||||
response = github.post(
|
||||
"/repos/{}/circuitpython-org/git/refs".format(user), json=create_branch
|
||||
)
|
||||
if not response.ok and response.json()["message"] != "Reference already exists":
|
||||
print("unable to create branch")
|
||||
print(response.text)
|
||||
|
@ -186,10 +201,13 @@ def create_pr(changes, updated, git_info, user):
|
|||
"message": message,
|
||||
"content": base64.b64encode(updated).decode("utf-8"),
|
||||
"sha": original_blob_sha,
|
||||
"branch": branch_name
|
||||
"branch": branch_name,
|
||||
}
|
||||
|
||||
response = github.put("/repos/{}/circuitpython-org/contents/_data/files.json".format(user), json=update_file)
|
||||
response = github.put(
|
||||
"/repos/{}/circuitpython-org/contents/_data/files.json".format(user),
|
||||
json=update_file,
|
||||
)
|
||||
if not response.ok:
|
||||
print("unable to post new file")
|
||||
print(response.text)
|
||||
|
@ -199,7 +217,7 @@ def create_pr(changes, updated, git_info, user):
|
|||
"head": user + ":" + branch_name,
|
||||
"base": "master",
|
||||
"body": message,
|
||||
"maintainer_can_modify": True
|
||||
"maintainer_can_modify": True,
|
||||
}
|
||||
response = github.post("/repos/adafruit/circuitpython-org/pulls", json=pr_info)
|
||||
if not response.ok:
|
||||
|
@ -220,17 +238,14 @@ def print_active_user():
|
|||
print("Not logged in")
|
||||
return None
|
||||
|
||||
|
||||
def generate_download_info():
|
||||
boards = {}
|
||||
errors = []
|
||||
|
||||
new_tag = os.environ["RELEASE_TAG"]
|
||||
|
||||
changes = {
|
||||
"new_release": new_tag,
|
||||
"new_boards": [],
|
||||
"new_languages": []
|
||||
}
|
||||
changes = {"new_release": new_tag, "new_boards": [], "new_languages": []}
|
||||
|
||||
user = print_active_user()
|
||||
|
||||
|
@ -254,8 +269,9 @@ def generate_download_info():
|
|||
info = current_info[board]
|
||||
for version in info["versions"]:
|
||||
previous_releases.add(version["version"])
|
||||
previous_languages.update(version["files"].keys())
|
||||
if version["stable"] == new_stable:
|
||||
if version["stable"] == new_stable or (
|
||||
new_stable and version["version"].startswith(this_version)
|
||||
):
|
||||
info["versions"].remove(version)
|
||||
|
||||
board_mapping = get_board_mapping()
|
||||
|
@ -272,29 +288,15 @@ def generate_download_info():
|
|||
alias_info = board_mapping[alias]
|
||||
if alias not in current_info:
|
||||
changes["new_boards"].append(alias)
|
||||
current_info[alias] = {"downloads": 0,
|
||||
"versions": []}
|
||||
current_info[alias] = {"downloads": 0, "versions": []}
|
||||
|
||||
new_version = {
|
||||
"stable": new_stable,
|
||||
"version": new_tag,
|
||||
"modules": support_matrix.get(alias, "[]"),
|
||||
"files": {},
|
||||
"languages": languages,
|
||||
"extensions": board_info["extensions"]
|
||||
"extensions": board_info["extensions"],
|
||||
}
|
||||
for language in languages:
|
||||
files = []
|
||||
new_version["files"][language] = files
|
||||
for extension in board_info["extensions"]:
|
||||
files.append(
|
||||
"{base_url}/{alias}/{language}/adafruit-circuitpython-{alias}-{language}-{tag}.{extension}"
|
||||
.format(
|
||||
base_url=DOWNLOAD_BASE_URL,
|
||||
tag=new_tag,
|
||||
alias=alias,
|
||||
language=language,
|
||||
extension=extension))
|
||||
current_info[alias]["downloads"] = alias_info["download_count"]
|
||||
current_info[alias]["versions"].append(new_version)
|
||||
|
||||
|
@ -305,6 +307,7 @@ def generate_download_info():
|
|||
else:
|
||||
print("No new release to update")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if "RELEASE_TAG" in os.environ and os.environ["RELEASE_TAG"]:
|
||||
generate_download_info()
|
||||
|
|
Loading…
Reference in New Issue