From 8d389467be139f4b0493f8371625c62344cc6ee6 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Mon, 27 Jun 2022 14:48:33 +0100 Subject: [PATCH] Switch to the simpler podman cp implementation The trick is "{src_path}/.". See https://docs.podman.io/en/latest/markdown/podman-cp.1.html#description --- cibuildwheel/docker_container.py | 33 ++------------------------------ 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/cibuildwheel/docker_container.py b/cibuildwheel/docker_container.py index cad594d8..f62ee557 100644 --- a/cibuildwheel/docker_container.py +++ b/cibuildwheel/docker_container.py @@ -192,45 +192,16 @@ class DockerContainer: # note: we assume from_path is a dir to_path.mkdir(parents=True, exist_ok=True) - TRY_SIMPLE_CP = 0 - if TRY_SIMPLE_CP: + if self.container_engine == "podman": # There is a bug in docker that prevents this simple implementation # from working https://github.com/moby/moby/issues/38995 - # It seems to also not workin podman as well - command = f"{self.container_engine} cp {self.name}:{shell_quote(from_path)} {shell_quote(to_path)}" + command = f"{self.container_engine} cp {self.name}:{shell_quote(from_path)}/. {shell_quote(to_path)}" subprocess.run( command, shell=True, check=True, cwd=to_path, ) - elif self.container_engine == "podman": - # The copy out logic that works for docker does not seem to - # translate to podman, which seems to need the steps spelled out - # more explicitly. - command = f"{self.container_engine} exec -i {self.name} tar -cC {shell_quote(from_path)} -f /tmp/output-{self.name}.tar ." - subprocess.run( - command, - shell=True, - check=True, - cwd=to_path, - ) - - command = f"{self.container_engine} cp {self.name}:/tmp/output-{self.name}.tar output-{self.name}.tar" - subprocess.run( - command, - shell=True, - check=True, - cwd=to_path, - ) - command = f"tar -xvf output-{self.name}.tar" - subprocess.run( - command, - shell=True, - check=True, - cwd=to_path, - ) - os.unlink(to_path / f"output-{self.name}.tar") elif self.container_engine == "docker": command = f"{self.container_engine} exec -i {self.name} tar -cC {shell_quote(from_path)} -f - . | tar -xf -" subprocess.run(