From 397af5542b6df5ef6a79595eaf64f3083e9b557a Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Mon, 20 Mar 2023 19:20:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Run=20the=20correct=20image=20wh?= =?UTF-8?q?en=20user=20called=20'ocrd=20resmgr=20{download,list-available}?= =?UTF-8?q?'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wrapper/qurator/ocrd_galley/cli.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/wrapper/qurator/ocrd_galley/cli.py b/wrapper/qurator/ocrd_galley/cli.py index 8f3c8b9..e615791 100644 --- a/wrapper/qurator/ocrd_galley/cli.py +++ b/wrapper/qurator/ocrd_galley/cli.py @@ -63,7 +63,19 @@ def main(): argv = sys.argv.copy() argv[0] = os.path.basename(argv[0]) - sub_image = sub_images[argv[0]] + # If we're running ocrd resmgr download we need to run the correct subimage. + if argv[:3] == ["ocrd", "resmgr", "download"] or \ + argv[:3] == ["ocrd", "resmgr", "list-available"]: + # Default to the base image + sub_image = sub_images[argv[0]] + # But look for a match of the executable + for x in argv[3:]: + if x in sub_images: + sub_image = sub_images[x] + break + else: + sub_image = sub_images[argv[0]] + docker_image = "%s-%s:%s" % (DOCKER_IMAGE_PREFIX, sub_image, DOCKER_IMAGE_TAG) if DOCKER_IMAGE_TAG != "latest":