diff --git a/cibuildwheel/environment.py b/cibuildwheel/environment.py index d0e14a02..9f7ea2c4 100644 --- a/cibuildwheel/environment.py +++ b/cibuildwheel/environment.py @@ -1,6 +1,6 @@ import bashlex # type: ignore -from typing import Dict, List, MutableMapping +from typing import Dict, List, Mapping from . import bashlex_eval @@ -61,7 +61,7 @@ class ParsedEnvironment: def __init__(self, assignments: List[EnvironmentAssignment]): self.assignments = assignments - def as_dictionary(self, prev_environment: MutableMapping[str, str]) -> Dict[str, str]: + def as_dictionary(self, prev_environment: Mapping[str, str]) -> Dict[str, str]: environment = dict(**prev_environment) for assignment in self.assignments: diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index aa672f7b..aa620f21 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -134,22 +134,24 @@ def build(options: BuildOptions) -> None: call(['docker', 'start', container_name]) if options.before_all: - before_all_prepared = prepare_command(options.before_all, project='/project', package=options.package_dir) - task = """ - PS4=' + ' + call( + ['docker', 'exec', '-i', container_name] + shell_cmd, + universal_newlines=True, + input=''' + PS4=' + ' - set -o errexit - set -o xtrace + set -o errexit + set -o xtrace - {environment_exports} + {environment_exports} - {before_all_prepared} + sh -c {before_all} - """.format( - environment_exports='\n'.join(options.environment.as_shell_commands()), - before_all_prepared=before_all_prepared + '''.format( + environment_exports='\n'.join(options.environment.as_shell_commands()), + before_all=prepare_command(options.before_all, project='/project', package=container_package_dir) + ) ) - call(['docker', 'exec', '-i', container_name] + shell_cmd, universal_newlines=True, input=task) for config in platform_configs: if options.dependency_constraints: