Skip to content

Commit 910af18

Browse files
committed
tools/build.py: Add "path" entry to index.json.
This points to the package's base directory of the within the micropython-lib directory structure. Signed-off-by: Damien George <damien@micropython.org>
1 parent 60d1370 commit 910af18

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

tools/build.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
# index.json is:
6666
# {
67-
# "v": 1, <-- file format version
67+
# "v": 2, <-- file format version
6868
# "updated": <utc-seconds-since-1970>,
6969
# "packages": {
7070
# {
@@ -78,7 +78,9 @@
7878
# "7": ["0.2", "0.3", "0.4"],
7979
# ... <-- Other bytecode versions
8080
# "py": ["0.1", "0.2", "0.3", "0.4"]
81-
# }
81+
# },
82+
# // The following entries were added in file format version 2.
83+
# path: "micropython/bluetooth/aioble",
8284
# },
8385
# ...
8486
# }
@@ -122,7 +124,7 @@
122124
import time
123125

124126

125-
_JSON_VERSION_INDEX = 1
127+
_JSON_VERSION_INDEX = 2
126128
_JSON_VERSION_PACKAGE = 1
127129

128130

@@ -268,7 +270,7 @@ def _copy_as_py(
268270

269271
# Update to the latest metadata, and add any new versions to the package in
270272
# the index json.
271-
def _update_index_package_metadata(index_package_json, metadata, mpy_version):
273+
def _update_index_package_metadata(index_package_json, metadata, mpy_version, package_path):
272274
index_package_json["version"] = metadata.version or ""
273275
index_package_json["author"] = "" # TODO: Make manifestfile.py capture this.
274276
index_package_json["description"] = metadata.description or ""
@@ -283,6 +285,9 @@ def _update_index_package_metadata(index_package_json, metadata, mpy_version):
283285
print(" New version {}={}".format(v, metadata.version))
284286
index_package_json["versions"][v].append(metadata.version)
285287

288+
# The following entries were added in file format version 2.
289+
index_package_json["path"] = package_path
290+
286291

287292
def build(output_path, hash_prefix_len, mpy_cross_path):
288293
import manifestfile
@@ -318,7 +323,8 @@ def build(output_path, hash_prefix_len, mpy_cross_path):
318323

319324
for lib_dir in lib_dirs:
320325
for manifest_path in glob.glob(os.path.join(lib_dir, "**", "manifest.py"), recursive=True):
321-
print("{}".format(os.path.dirname(manifest_path)))
326+
package_path = os.path.dirname(manifest_path)
327+
print("{}".format(package_path))
322328
# .../foo/manifest.py -> foo
323329
package_name = os.path.basename(os.path.dirname(manifest_path))
324330

@@ -342,7 +348,9 @@ def build(output_path, hash_prefix_len, mpy_cross_path):
342348
}
343349
index_json["packages"].append(index_package_json)
344350

345-
_update_index_package_metadata(index_package_json, manifest.metadata(), mpy_version)
351+
_update_index_package_metadata(
352+
index_package_json, manifest.metadata(), mpy_version, package_path
353+
)
346354

347355
# This is the package json that mip/mpremote downloads.
348356
mpy_package_json = {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy