-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change: Add ability to switch between two sets of flasher stubs
- Loading branch information
1 parent
6e8632d
commit 3731e11
Showing
85 changed files
with
403 additions
and
33,000 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
include README.md | ||
include LICENSE | ||
include esptool/targets/stub_flasher/*.json | ||
include esptool/targets/stub_flasher/1/* | ||
include esptool/targets/stub_flasher/2/* | ||
include espefuse/efuse_defs/*.yaml | ||
# sdist includes test/test*.py by default, but esptool.py tests | ||
# are so far only intended to run from the git repo itself | ||
prune test | ||
prune flasher_stub | ||
prune .github | ||
prune docs | ||
exclude .git* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/usr/bin/env python | ||
# | ||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
import glob | ||
import os | ||
import urllib.request | ||
|
||
STUBS = ( | ||
{ | ||
"STUB_SET_VERSION": "1", | ||
"DOWNLOAD_URL": "https://github.com/espressif/esptool-legacy-flasher-stub/releases/download", | ||
"TAG_URL": "https://github.com/espressif/esptool-legacy-flasher-stub/releases/tag", | ||
"VERSION": "v1.2.0", | ||
"FILE_LIST": ( | ||
"esp32", | ||
"esp32c2", | ||
"esp32c3", | ||
"esp32c5", | ||
"esp32c5beta3", | ||
"esp32c6", | ||
"esp32c6beta", | ||
"esp32h2", | ||
"esp32h2beta1", | ||
"esp32h2beta2", | ||
"esp32p4", | ||
"esp32s2", | ||
"esp32s3", | ||
"esp32s3beta2", | ||
"esp8266", | ||
), | ||
"LICENSE": "released as Free Software under GNU General Public License Version 2 or later", | ||
}, | ||
{ | ||
"STUB_SET_VERSION": "2", | ||
"DOWNLOAD_URL": "https://github.com/esp-rs/esp-flasher-stub/releases/download", | ||
"TAG_URL": "https://github.com/esp-rs/esp-flasher-stub/releases/tag", | ||
"VERSION": "v0.3.0", | ||
"FILE_LIST": ( | ||
"esp32", | ||
"esp32c2", | ||
"esp32c3", | ||
"esp32c6", | ||
"esp32h2", | ||
"esp32s2", | ||
"esp32s3", | ||
), | ||
"LICENSE": "dual licensed under the Apache License Version 2.0 or the MIT license", | ||
}, | ||
) | ||
|
||
DESTINATION_DIR = "esptool/targets/stub_flasher" | ||
|
||
README_TEMPLATE = """# Licensing | ||
The binaries in JSON format distributed in this directory are {LICENSE}. They were released at {URL} from where the sources can be obtained. | ||
""" | ||
|
||
|
||
def main(): | ||
for stub_set in STUBS: | ||
dest_sub_dir = os.path.join(DESTINATION_DIR, stub_set["STUB_SET_VERSION"]) | ||
|
||
""" The directory is cleaned up so we would detect if a stub was just committed into the repository but the | ||
name was not added into the FILE_LIST of STUBS. This would be an unwanted state because the checker would not | ||
detect any changes in that stub.""" | ||
for old_file in glob.glob(os.path.join(dest_sub_dir, "*.json")): | ||
print(f"Removing old file {old_file}") | ||
os.remove(old_file) | ||
|
||
for file_name in stub_set["FILE_LIST"]: | ||
file = ".".join((file_name, "json")) | ||
url = "/".join((stub_set["DOWNLOAD_URL"], stub_set["VERSION"], file)) | ||
dest = os.path.join(dest_sub_dir, file) | ||
print(f"Downloading {url} to {dest}") | ||
urllib.request.urlretrieve(url, dest) | ||
|
||
with open(os.path.join(dest_sub_dir, "README.md"), "w") as f: | ||
print(f"Writing README to {f.name}") | ||
f.write( | ||
README_TEMPLATE.format( | ||
LICENSE=stub_set["LICENSE"], | ||
URL="/".join((stub_set["TAG_URL"], stub_set["VERSION"])), | ||
) | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.