Skip to content

Commit ffa8fe9

Browse files
committed
Add library versions to JSON
1 parent 3b529b4 commit ffa8fe9

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

circuitpython_build_tools/build.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ def get_package_info(library_path, package_folder_prefix):
135135
package_info["module_name"] = py_files[0].relative_to(library_path).name[:-3]
136136
else:
137137
package_info["module_name"] = None
138-
138+
139+
try:
140+
package_info["version"] = version_string(library_path, valid_semver=True)
141+
except ValueError as e:
142+
package_info["version"] = version_string(library_path)
143+
139144
return package_info
140145

141146
def library(library_path, output_directory, package_folder_prefix,

circuitpython_build_tools/scripts/build_bundles.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ def build_bundle_json(libs, bundle_version, output_filename, package_folder_pref
9797
library = {}
9898
package_info = build.get_package_info(library_path, package_folder_prefix)
9999
module_name = get_module_name(library_path)
100-
library["package"] = package_info["is_package"]
101-
library["path"] = "lib/" + package_info["module_name"]
102-
library["dependencies"] = get_bundle_requirements(library_path)
103-
library_submodules[module_name] = library
100+
if package_info["module_name"] is not None:
101+
library["package"] = package_info["is_package"]
102+
library["version"] = package_info["version"]
103+
library["path"] = "lib/" + package_info["module_name"]
104+
library["dependencies"] = get_bundle_requirements(library_path)
105+
library_submodules[module_name] = library
104106
out_file = open(output_filename, "w")
105107
json.dump(library_submodules, out_file)
106108
out_file.close()

0 commit comments

Comments
 (0)