Capture output in DockerContainer.environment_executor to fix command substitutions in CIBW_ENVIRONMENT on Linux

This commit is contained in:
Yannick Jadoul
2020-07-20 02:23:07 +02:00
parent e28e43e7f9
commit 3142806f4b
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -182,7 +182,7 @@ class DockerContainer:
def environment_executor(self, command: List[str], environment: Dict[str, str]) -> str:
# used as an EnvironmentExecutor to evaluate commands and capture output
return self.call(command, env=environment)
return self.call(command, env=environment, capture_output=True)
def shell_quote(path: PurePath) -> str:
+8
View File
@@ -8,6 +8,7 @@ from pathlib import Path, PurePath
import pytest
from cibuildwheel.docker_container import DockerContainer
from cibuildwheel.environment import EnvironmentAssignment
# for these tests we use manylinux2014 images, because they're available on
# multi architectures and include python3.8
@@ -145,3 +146,10 @@ def test_dir_operations(tmp_path: Path):
container.copy_out(dst_dir, new_test_dir)
assert test_binary_data == (new_test_dir / 'test.dat').read_bytes()
@pytest.mark.docker
def test_environment_executor():
with DockerContainer(DEFAULT_IMAGE) as container:
assignment = EnvironmentAssignment("TEST=$(echo 42)")
assert assignment.evaluated_value({}, container.environment_executor) == "42"