Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix json output when a bundle does not use submodules #110

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions circuitpython_build_tools/scripts/build_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def build_bundle_json(libs, bundle_version, output_filename, package_folder_pref
"""
Generate a JSON file of all the libraries in libs
"""
packages = {}
packages = []
for library_path in libs:
package = {}
package_info = build.get_package_info(library_path, package_folder_prefix)
Expand All @@ -130,18 +130,19 @@ def build_bundle_json(libs, bundle_version, output_filename, package_folder_pref
package["version"] = package_info["version"]
package["path"] = "lib/" + package_info["module_name"]
package["library_path"] = library_path
packages[module_name] = package
packages.append(package)

library_submodules = {}
for id in packages:
for package in packages:
library = {}
library["package"] = packages[id]["is_folder"]
library["pypi_name"] = packages[id]["pypi_name"]
library["version"] = packages[id]["version"]
library["repo"] = packages[id]["repo"]
library["path"] = packages[id]["path"]
library["dependencies"], library["external_dependencies"] = get_bundle_requirements(packages[id]["library_path"], packages)
library_submodules[packages[id]["module_name"]] = library
library["package"] = package["is_folder"]
library["pypi_name"] = package["pypi_name"]
library["version"] = package["version"]
library["repo"] = package["repo"]
library["path"] = package["path"]
library["dependencies"], library["external_dependencies"] = get_bundle_requirements(package["library_path"], packages)
library_submodules[package["module_name"]] = library

out_file = open(output_filename, "w")
json.dump(library_submodules, out_file, sort_keys=True)
out_file.close()
Expand Down
Loading