Skip to content

Add library versions to JSON #65

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

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion circuitpython_build_tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ def get_package_info(library_path, package_folder_prefix):
package_info["module_name"] = py_files[0].relative_to(library_path).name[:-3]
else:
package_info["module_name"] = None


try:
package_info["version"] = version_string(library_path, valid_semver=True)
except ValueError as e:
package_info["version"] = version_string(library_path)

return package_info

def library(library_path, output_directory, package_folder_prefix,
Expand Down
10 changes: 6 additions & 4 deletions circuitpython_build_tools/scripts/build_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ def build_bundle_json(libs, bundle_version, output_filename, package_folder_pref
library = {}
package_info = build.get_package_info(library_path, package_folder_prefix)
module_name = get_module_name(library_path)
library["package"] = package_info["is_package"]
library["path"] = "lib/" + package_info["module_name"]
library["dependencies"] = get_bundle_requirements(library_path)
library_submodules[module_name] = library
if package_info["module_name"] is not None:
library["package"] = package_info["is_package"]
library["version"] = package_info["version"]
library["path"] = "lib/" + package_info["module_name"]
library["dependencies"] = get_bundle_requirements(library_path)
library_submodules[module_name] = library
out_file = open(output_filename, "w")
json.dump(library_submodules, out_file)
out_file.close()
Expand Down