Skip to content

Commit

Permalink
Merge pull request #65 from makermelissa/master
Browse files Browse the repository at this point in the history
Add library versions to JSON
  • Loading branch information
makermelissa authored Mar 24, 2021
2 parents 3b529b4 + ffa8fe9 commit 248bc56
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
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

0 comments on commit 248bc56

Please sign in to comment.