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# {
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# }
122124import 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
287292def 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