forked from micropython/micropython-esp32-ulp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request micropython#94 from wnienhaus/mip_support
Add package.json for MIP package manager
- Loading branch information
Showing
4 changed files
with
83 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"v":1, | ||
"urls":[ | ||
["esp32_ulp/__init__.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/__init__.py"], | ||
["esp32_ulp/__main__.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/__main__.py"], | ||
["esp32_ulp/assemble.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/assemble.py"], | ||
["esp32_ulp/definesdb.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/definesdb.py"], | ||
["esp32_ulp/link.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/link.py"], | ||
["esp32_ulp/nocomment.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/nocomment.py"], | ||
["esp32_ulp/opcodes.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/opcodes.py"], | ||
["esp32_ulp/opcodes_s2.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/opcodes_s2.py"], | ||
["esp32_ulp/parse_to_db.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/parse_to_db.py"], | ||
["esp32_ulp/preprocess.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/preprocess.py"], | ||
["esp32_ulp/soc.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/soc.py"], | ||
["esp32_ulp/soc_s2.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/soc_s2.py"], | ||
["esp32_ulp/soc_s3.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/soc_s3.py"], | ||
["esp32_ulp/util.py", "github:micropython/micropython-esp32-ulp/esp32_ulp/util.py"] | ||
] | ||
} |
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,50 @@ | ||
""" | ||
Tool for generating package.json for the MIP package manager | ||
Run this tool from the repo root, like: | ||
python tools/genpkgjson.py > package.json | ||
Note: | ||
This tool works with both python3 and micropyton. | ||
""" | ||
|
||
import os | ||
import json | ||
|
||
PACKAGE_JSON_VERSION=1 | ||
|
||
# Update the repo when working with a fork | ||
GITHUB_REPO="micropython/micropython-esp32-ulp" | ||
|
||
|
||
def get_files(path): | ||
files = [f'{path}/{f}' for f in os.listdir(path)] | ||
return files | ||
|
||
|
||
def build_urls(repo_base, files): | ||
return [[f, f'github:{repo_base}/{f}'] for f in files] | ||
|
||
|
||
def print_package_json(urls): | ||
""" | ||
Custom-formatting JSON output for better readability | ||
json.dumps in MicroPython cannot format the output and python3 | ||
puts each element of each urls' sub-arrays onto a new line. | ||
Here we print each file and its source url onto the same line. | ||
""" | ||
print('{') | ||
print(f' "v":{PACKAGE_JSON_VERSION},') | ||
print(' "urls":[') | ||
print(',\n'.join([f' {json.dumps(u)}' for u in sorted(urls)])) | ||
print(' ]') | ||
print('}') | ||
|
||
|
||
if __name__ == '__main__': | ||
library_root = 'esp32_ulp' | ||
files = get_files(library_root) | ||
urls = build_urls(GITHUB_REPO, files) | ||
print_package_json(urls) |