From a0dab888a7e33b90b74155ddb70ecb69c9e3528e Mon Sep 17 00:00:00 2001 From: Yannick Jadoul Date: Tue, 2 Jun 2020 15:09:41 +0200 Subject: [PATCH 1/2] Ignore errors when cleaning up docker container in linux.py --- cibuildwheel/linux.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index 652d9eb3..b429a4f3 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -279,7 +279,10 @@ def build(options: BuildOptions) -> None: exit(1) finally: # Still gets executed, even when 'exit(1)' gets called - call(['docker', 'rm', '--force', '-v', container_name]) + try: + call(['docker', 'rm', '--force', '-v', container_name]) + except subprocess.CalledProcessError: + pass def troubleshoot(package_dir: str, error: Exception) -> None: From 46688ae3f9684686a0682764c8606634bda4c078 Mon Sep 17 00:00:00 2001 From: Yannick Jadoul Date: Tue, 2 Jun 2020 17:13:23 +0200 Subject: [PATCH 2/2] Revert previous solution and just don't try removing the container if 'docker create' errors --- cibuildwheel/linux.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index b429a4f3..3a660ef1 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -114,18 +114,18 @@ def build(options: BuildOptions) -> None: if not platform_configs: continue + shell_cmd = ['linux32', '/bin/bash'] if platform_tag.endswith("i686") else ['/bin/bash'] + container_name = f'cibuildwheel-{uuid.uuid4()}' + call(['docker', 'create', + '--env', 'CIBUILDWHEEL', + '--name', container_name, + '-i', + '-v', '/:/host', # ignored on CircleCI + docker_image, + '/bin/bash']) try: - shell_cmd = ['linux32', '/bin/bash'] if platform_tag.endswith("i686") else ['/bin/bash'] - call(['docker', 'create', - '--env', 'CIBUILDWHEEL', - '--name', container_name, - '-i', - '-v', '/:/host', # ignored on CircleCI - docker_image, - '/bin/bash']) - call(['docker', 'cp', '.', container_name + ':/project']) call(['docker', 'start', container_name]) @@ -279,10 +279,7 @@ def build(options: BuildOptions) -> None: exit(1) finally: # Still gets executed, even when 'exit(1)' gets called - try: - call(['docker', 'rm', '--force', '-v', container_name]) - except subprocess.CalledProcessError: - pass + call(['docker', 'rm', '--force', '-v', container_name]) def troubleshoot(package_dir: str, error: Exception) -> None: