Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb284091

Browse files
committed
Add package.json for MIP package manager
Also add a tool for generating package.json, so it doesn't haveto be handcrafted when files are added/removed.To generate/update package.json, run from repo root as follows:python3 tools/genpkgjson.py > package.json(instead of python3, micropython can also be used)Note: at present MIP does not support any way to specify repo-relativeurls, so at present the generated json will point togituhub:micropython/micropython-esp32-ulp, which would need to beadapted in any forks of this repo.
1 parent25bf34e commitb284091

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

‎package.json‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"v":1,
3+
"urls":[
4+
["esp32_ulp/__init__.py","github:micropython/micropython-esp32-ulp/esp32_ulp/__init__.py"],
5+
["esp32_ulp/__main__.py","github:micropython/micropython-esp32-ulp/esp32_ulp/__main__.py"],
6+
["esp32_ulp/assemble.py","github:micropython/micropython-esp32-ulp/esp32_ulp/assemble.py"],
7+
["esp32_ulp/definesdb.py","github:micropython/micropython-esp32-ulp/esp32_ulp/definesdb.py"],
8+
["esp32_ulp/link.py","github:micropython/micropython-esp32-ulp/esp32_ulp/link.py"],
9+
["esp32_ulp/nocomment.py","github:micropython/micropython-esp32-ulp/esp32_ulp/nocomment.py"],
10+
["esp32_ulp/opcodes.py","github:micropython/micropython-esp32-ulp/esp32_ulp/opcodes.py"],
11+
["esp32_ulp/opcodes_s2.py","github:micropython/micropython-esp32-ulp/esp32_ulp/opcodes_s2.py"],
12+
["esp32_ulp/parse_to_db.py","github:micropython/micropython-esp32-ulp/esp32_ulp/parse_to_db.py"],
13+
["esp32_ulp/preprocess.py","github:micropython/micropython-esp32-ulp/esp32_ulp/preprocess.py"],
14+
["esp32_ulp/soc.py","github:micropython/micropython-esp32-ulp/esp32_ulp/soc.py"],
15+
["esp32_ulp/soc_s2.py","github:micropython/micropython-esp32-ulp/esp32_ulp/soc_s2.py"],
16+
["esp32_ulp/soc_s3.py","github:micropython/micropython-esp32-ulp/esp32_ulp/soc_s3.py"],
17+
["esp32_ulp/util.py","github:micropython/micropython-esp32-ulp/esp32_ulp/util.py"]
18+
]
19+
}

‎tools/genpkgjson.py‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""
2+
Tool for generating package.json for the MIP package manager
3+
4+
Run this tool from the repo root, like:
5+
6+
python tools/genpkgjson.py > package.json
7+
8+
Note:
9+
This tool works with both python3 and micropyton.
10+
"""
11+
12+
importos
13+
importjson
14+
15+
PACKAGE_JSON_VERSION=1
16+
17+
# Update the repo when working with a fork
18+
GITHUB_REPO="micropython/micropython-esp32-ulp"
19+
20+
21+
defget_files(path):
22+
files= [f'{path}/{f}'forfinos.listdir(path)]
23+
returnfiles
24+
25+
26+
defbuild_urls(repo_base,files):
27+
return [[f,f'github:{repo_base}/{f}']forfinfiles]
28+
29+
30+
defprint_package_json(urls):
31+
"""
32+
Custom-formatting JSON output for better readability
33+
34+
json.dumps in MicroPython cannot format the output and python3
35+
puts each element of each urls' sub-arrays onto a new line.
36+
Here we print each file and its source url onto the same line.
37+
"""
38+
print('{')
39+
print(f' "v":{PACKAGE_JSON_VERSION},')
40+
print(' "urls":[')
41+
print(',\n'.join([f'{json.dumps(u)}'foruinsorted(urls)]))
42+
print(' ]')
43+
print('}')
44+
45+
46+
if__name__=='__main__':
47+
library_root='esp32_ulp'
48+
files=get_files(library_root)
49+
urls=build_urls(GITHUB_REPO,files)
50+
print_package_json(urls)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp