Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CIBW_DEBUG_KEEP_CONTAINER: debug container after build #1620

Merged
merged 4 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 15 additions & 7 deletions cibuildwheel/oci_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
from typing import IO, Dict, Literal

from .typing import PathOrStr, PopenBytes
from .util import CIProvider, call, detect_ci_provider, parse_key_value_string
from .util import (
CIProvider,
call,
detect_ci_provider,
parse_key_value_string,
strtobool,
)

ContainerEngineName = Literal["docker", "podman"]

Expand Down Expand Up @@ -188,12 +194,14 @@ def __exit__(

assert isinstance(self.name, str)

subprocess.run(
[self.engine.name, "rm", "--force", "-v", self.name],
stdout=subprocess.DEVNULL,
check=False,
)
self.name = None
keep_container = strtobool(os.environ.get("CIBW_DEBUG_KEEP_CONTAINER", ""))
if not keep_container:
subprocess.run(
[self.engine.name, "rm", "--force", "-v", self.name],
stdout=subprocess.DEVNULL,
check=False,
)
self.name = None

def copy_into(self, from_path: Path, to_path: PurePath) -> None:
# `docker cp` causes 'no space left on device' error when
Expand Down
18 changes: 17 additions & 1 deletion docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,23 @@ This option is not supported in the overrides section in `pyproject.toml`.
test-skip = "*-macosx_arm64 *-macosx_universal2:arm64"
```

## Other
## Debugging

### `CIBW_DEBUG_KEEP_CONTAINER`

Enable this flag to keep the container around for inspection after a build. This
option is provided for debugging purposes only.

Default: Off (0).

!!! caution
This option can only be set as environment variable on the host machine

#### Examples

```shell
export CIBW_DEBUG_KEEP_CONTAINER=TRUE
```

### `CIBW_BUILD_VERBOSITY` {: #build-verbosity}
> Increase/decrease the output of pip wheel
Expand Down