Skip to content

Commit 34cb857

Browse files
committed
Fail a multi-lib build when a submodule is missing a release.
1 parent a6489f9 commit 34cb857

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

circuitpython_build_tools/scripts/build_bundles.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ def build_bundle(libs, bundle_version, output_filename,
7575
with open(os.path.join(build_lib_dir, "VERSIONS.txt"), "w") as f:
7676
f.write(bundle_version + "\r\n")
7777
versions = subprocess.run('git submodule foreach \"git remote get-url origin && git describe --tags\"', shell=True, stdout=subprocess.PIPE)
78+
if versions.returncode != 0:
79+
print("Failed to generate versions file. Its likely a library hasn't been "
80+
"released yet.")
81+
success = False
82+
7883
repo = None
7984
for line in versions.stdout.split(b"\n"):
8085
if line.startswith(b"Entering") or not line:
@@ -86,6 +91,10 @@ def build_bundle(libs, bundle_version, output_filename,
8691
else:
8792
f.write(repo.decode("utf-8", "strict") + "/releases/tag/" + line.strip().decode("utf-8", "strict") + "\r\n")
8893

94+
if not success:
95+
print("WARNING: some failures above")
96+
sys.exit(2)
97+
8998
print()
9099
print("Zipping")
91100

@@ -106,9 +115,6 @@ def build_bundle(libs, bundle_version, output_filename,
106115
print()
107116
print(total_size, "B", total_size / 1024, "kiB", total_size / 1024 / 1024, "MiB")
108117
print("Bundled in", output_filename)
109-
if not success:
110-
print("WARNING: some failures above")
111-
sys.exit(2)
112118

113119
def _find_libraries(current_path, depth):
114120
if depth <= 0:
@@ -131,7 +137,6 @@ def build_bundles(filename_prefix, output_directory, library_location, library_d
131137
bundle_version = build.version_string()
132138

133139
libs = _find_libraries(os.path.abspath(library_location), library_depth)
134-
print(libs)
135140

136141
pkg = pkg_resources.get_distribution("circuitpython-build-tools")
137142
build_tools_version = "devel"

0 commit comments

Comments
 (0)