Skip to content

Commit 152702f

Browse files
authored
Merge pull request #110 from jepler/fix-metadata-without-submodules
Fix json output when a bundle does not use submodules
2 parents c6ebe5e + ff6d40d commit 152702f

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

circuitpython_build_tools/scripts/build_bundles.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def build_bundle_json(libs, bundle_version, output_filename, package_folder_pref
117117
"""
118118
Generate a JSON file of all the libraries in libs
119119
"""
120-
packages = {}
120+
packages = []
121121
for library_path in libs:
122122
package = {}
123123
package_info = build.get_package_info(library_path, package_folder_prefix)
@@ -130,18 +130,19 @@ def build_bundle_json(libs, bundle_version, output_filename, package_folder_pref
130130
package["version"] = package_info["version"]
131131
package["path"] = "lib/" + package_info["module_name"]
132132
package["library_path"] = library_path
133-
packages[module_name] = package
133+
packages.append(package)
134134

135135
library_submodules = {}
136-
for id in packages:
136+
for package in packages:
137137
library = {}
138-
library["package"] = packages[id]["is_folder"]
139-
library["pypi_name"] = packages[id]["pypi_name"]
140-
library["version"] = packages[id]["version"]
141-
library["repo"] = packages[id]["repo"]
142-
library["path"] = packages[id]["path"]
143-
library["dependencies"], library["external_dependencies"] = get_bundle_requirements(packages[id]["library_path"], packages)
144-
library_submodules[packages[id]["module_name"]] = library
138+
library["package"] = package["is_folder"]
139+
library["pypi_name"] = package["pypi_name"]
140+
library["version"] = package["version"]
141+
library["repo"] = package["repo"]
142+
library["path"] = package["path"]
143+
library["dependencies"], library["external_dependencies"] = get_bundle_requirements(package["library_path"], packages)
144+
library_submodules[package["module_name"]] = library
145+
145146
out_file = open(output_filename, "w")
146147
json.dump(library_submodules, out_file, sort_keys=True)
147148
out_file.close()

0 commit comments

Comments
 (0)