diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index ce742d10..e1132100 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -4,7 +4,7 @@ import argparse, os, subprocess, sys, textwrap import cibuildwheel import cibuildwheel.linux, cibuildwheel.windows, cibuildwheel.macos from cibuildwheel.environment import parse_environment, EnvironmentParseError -from cibuildwheel.util import BuildSkipper +from cibuildwheel.util import BuildSkipper, Unbuffered def get_option_from_environment(option_name, platform=None, default=None): ''' @@ -142,6 +142,9 @@ def main(): elif platform == 'windows': pass + # Python is buffering by default when running on the CI platforms, giving problems interleaving subprocess call output with unflushed calls to 'print' + sys.stdout = Unbuffered(sys.stdout) + print_preamble(platform, build_options) if not os.path.exists(output_dir): diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index da946358..1c2ed1d3 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -7,14 +7,10 @@ except ImportError: from collections import namedtuple from glob import glob -from .util import prepare_command, get_build_verbosity_extra_flags, Unbuffered +from .util import prepare_command, get_build_verbosity_extra_flags def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, build_verbosity, skip, environment): - # Python under AppVeyor/Windows seems to be buffering by default, giving problems interleaving subprocess call output with unflushed calls to 'print' - sys.stdout.flush() - sys.stdout = Unbuffered(sys.stdout) - # run_with_env is a cmd file that sets the right environment variables to run_with_env = os.path.join(tempfile.gettempdir(), 'appveyor_run_with_env.cmd') if not os.path.exists(run_with_env):