Merge pull request #1781 from tannewt/build_aliases

Add alias support for unique board revs
crypto-aes
Dan Halbert 4 years ago committed by GitHub
commit 121d532a0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -42,6 +42,12 @@ extension_by_board = {
"pca10059": BIN_UF2
}
aliases_by_board = {
"circuitplayground_express": ["circuitplayground_express_4h", "circuitplayground_express_digikey_pycon2019"],
"gemma_m0": ["gemma_m0_pycon2018"],
"pewpew10": ["pewpew13"]
}
def get_languages():
languages = []
for f in os.scandir("../locale"):
@ -59,7 +65,17 @@ def get_board_mapping():
board_id = board_path.name
extensions = extension_by_port[port]
extensions = extension_by_board.get(board_path.name, extensions)
boards[board_id] = {"port": port, "extensions": extensions, "download_count": 0}
aliases = aliases_by_board.get(board_path.name, [])
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": []}
return boards
def get_version_info():
@ -235,23 +251,25 @@ def generate_download_info():
board_id = board_path.name
board_info = board_mapping[board_id]
if board_id not in current_info:
changes["new_boards"].append(board_id)
current_info[board_id] = {"downloads": 0,
"versions": []}
new_version = {
"stable": new_stable,
"version": new_tag,
"files": {}
}
for language in languages:
files = []
new_version["files"][language] = files
for extension in board_info["extensions"]:
files.append("https://github.com/adafruit/circuitpython/releases/download/{tag}/adafruit-circuitpython-{board}-{language}-{tag}.{extension}".format(tag=new_tag, board=board_id, language=language, extension=extension))
current_info[board_id]["downloads"] = board_info["download_count"]
current_info[board_id]["versions"].append(new_version)
for alias in [board_id] + board_info["aliases"]:
alias_info = board_mapping[alias]
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,
"files": {}
}
for language in languages:
files = []
new_version["files"][language] = files
for extension in board_info["extensions"]:
files.append("https://github.com/adafruit/circuitpython/releases/download/{tag}/adafruit-circuitpython-{alias}-{language}-{tag}.{extension}".format(tag=new_tag, alias=alias, language=language, extension=extension))
current_info[alias]["downloads"] = alias_info["download_count"]
current_info[alias]["versions"].append(new_version)
changes["new_languages"] = set(languages) - previous_languages

@ -48,14 +48,17 @@ for board in build_boards:
for extension in board_info["extensions"]:
temp_filename = "../ports/{port}/build-{board}/firmware.{extension}".format(port=board_info["port"], board=board, extension=extension)
final_filename = "adafruit-circuitpython-{board}-{language}-{version}.{extension}".format(board=board, language=language, version=version, extension=extension)
final_filename = os.path.join(bin_directory, final_filename)
try:
shutil.copyfile(temp_filename, final_filename)
except FileNotFoundError:
other_output = "Cannot find file {}".format(temp_filename)
if exit_status == 0:
exit_status = 1
for alias in board_info["aliases"] + [board]:
bin_directory = "../bin/{alias}/{language}".format(alias=alias, language=language)
os.makedirs(bin_directory, exist_ok=True)
final_filename = "adafruit-circuitpython-{alias}-{language}-{version}.{extension}".format(alias=alias, language=language, version=version, extension=extension)
final_filename = os.path.join(bin_directory, final_filename)
try:
shutil.copyfile(temp_filename, final_filename)
except FileNotFoundError:
other_output = "Cannot find file {}".format(temp_filename)
if exit_status == 0:
exit_status = 1
if travis:
print('travis_fold:start:adafruit-bins-{}-{}\\r'.format(language, board))

Loading…
Cancel
Save