Skip to content

Commit fbafd19

Browse files
committed
Build images when the image id cannot be determined
1 parent f39d4eb commit fbafd19

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

cpython-unix/build-main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def main():
9797
"toolchain-image-build.cross-riscv64",
9898
"toolchain-image-build.debian9",
9999
"toolchain-image-gcc",
100+
"toolchain-image-gcc.debian9",
100101
"toolchain-image-xcb",
101102
"toolchain-image-xcb.cross",
102103
"toolchain-image-xcb.cross-riscv64",

pythonbuild/docker.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,26 @@ def get_image(
7878
image_path = image_dir / image_name
7979
tar_path = image_path.with_suffix(".tar")
8080

81-
with image_path.open("r") as fh:
82-
image_id = fh.read().strip()
83-
8481
try:
85-
client.images.get(image_id)
86-
return image_id
87-
except docker.errors.ImageNotFound:
88-
if tar_path.exists():
89-
with tar_path.open("rb") as fh:
90-
data = fh.read()
91-
client.images.load(data)
92-
82+
with image_path.open("r") as fh:
83+
image_id = fh.read().strip()
84+
except FileNotFoundError:
85+
pass
86+
else:
87+
try:
88+
client.images.get(image_id)
9389
return image_id
90+
except docker.errors.ImageNotFound:
91+
if tar_path.exists():
92+
with tar_path.open("rb") as fh:
93+
data = fh.read()
94+
client.images.load(data)
9495

95-
else:
96-
return build_docker_image(
97-
client, str(source_dir).encode(), image_dir, name, host_platform
98-
)
96+
return image_id
97+
98+
return build_docker_image(
99+
client, str(source_dir).encode(), image_dir, name, host_platform
100+
)
99101

100102

101103
def copy_file_to_container(path, container, container_path, archive_path=None):

0 commit comments

Comments
 (0)