64
64
65
65
# index.json is:
66
66
# {
67
- # "v": 1 , <-- file format version
67
+ # "v": 2 , <-- file format version
68
68
# "updated": <utc-seconds-since-1970>,
69
69
# "packages": {
70
70
# {
78
78
# "7": ["0.2", "0.3", "0.4"],
79
79
# ... <-- Other bytecode versions
80
80
# "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",
82
84
# },
83
85
# ...
84
86
# }
122
124
import time
123
125
124
126
125
- _JSON_VERSION_INDEX = 1
127
+ _JSON_VERSION_INDEX = 2
126
128
_JSON_VERSION_PACKAGE = 1
127
129
128
130
@@ -268,7 +270,7 @@ def _copy_as_py(
268
270
269
271
# Update to the latest metadata, and add any new versions to the package in
270
272
# 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 ):
272
274
index_package_json ["version" ] = metadata .version or ""
273
275
index_package_json ["author" ] = "" # TODO: Make manifestfile.py capture this.
274
276
index_package_json ["description" ] = metadata .description or ""
@@ -283,6 +285,9 @@ def _update_index_package_metadata(index_package_json, metadata, mpy_version):
283
285
print (" New version {}={}" .format (v , metadata .version ))
284
286
index_package_json ["versions" ][v ].append (metadata .version )
285
287
288
+ # The following entries were added in file format version 2.
289
+ index_package_json ["path" ] = package_path
290
+
286
291
287
292
def build (output_path , hash_prefix_len , mpy_cross_path ):
288
293
import manifestfile
@@ -318,7 +323,8 @@ def build(output_path, hash_prefix_len, mpy_cross_path):
318
323
319
324
for lib_dir in lib_dirs :
320
325
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 ))
322
328
# .../foo/manifest.py -> foo
323
329
package_name = os .path .basename (os .path .dirname (manifest_path ))
324
330
@@ -342,7 +348,9 @@ def build(output_path, hash_prefix_len, mpy_cross_path):
342
348
}
343
349
index_json ["packages" ].append (index_package_json )
344
350
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
+ )
346
354
347
355
# This is the package json that mip/mpremote downloads.
348
356
mpy_package_json = {
0 commit comments