From 77de5fb2d02551eb7563ba1a42c74ad6581815fb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 2 Jan 2019 15:52:08 +0100 Subject: setup.py: Fix running under non-UTF8 locale Redirecting stderr to stdout causes an error when running under non-UTF8 locales. For the build scripts, it is also not desired to mix the output channels, so, remove the redirection. Change-Id: I6e3d05ede00537c3cc4c022780e8d0ed27bb0cad Fixes: PYSIDE-880 Reviewed-by: Alexandru Croitor --- build_scripts/setup_runner.py | 2 +- build_scripts/utils.py | 5 +---- coin_build_instructions.py | 15 --------------- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/build_scripts/setup_runner.py b/build_scripts/setup_runner.py index 8efb2883a..0e45a13f4 100644 --- a/build_scripts/setup_runner.py +++ b/build_scripts/setup_runner.py @@ -148,7 +148,7 @@ class SetupRunner(object): for cmd in self.invocations_list: cmd_as_string = " ".join(cmd) print("\nRunning process: {}\n".format(cmd_as_string)) - exit_code = run_process(cmd, redirect_stderr_to_stdout=False) + exit_code = run_process(cmd) if exit_code != 0: msg = textwrap.dedent(""" setup.py invocation failed with exit code: {}.\n\n diff --git a/build_scripts/utils.py b/build_scripts/utils.py index 924b698dc..9500b3409 100644 --- a/build_scripts/utils.py +++ b/build_scripts/utils.py @@ -399,10 +399,9 @@ def run_process_output(args, initial_env=None): result.append(line.rstrip()) return result -def run_process(args, initial_env=None, redirect_stderr_to_stdout=True): +def run_process(args, initial_env=None): """ Run process until completion and return the process exit code. - Prints both stdout and stderr to the console. No output is captured. """ log.info("Running process in directory {0}: command {1}".format( @@ -415,8 +414,6 @@ def run_process(args, initial_env=None, redirect_stderr_to_stdout=True): kwargs = {} kwargs['env'] = initial_env - if redirect_stderr_to_stdout: - kwargs['stderr'] = subprocess.STDOUT exit_code = subprocess.call(args, **kwargs) return exit_code diff --git a/coin_build_instructions.py b/coin_build_instructions.py index 969b9272b..db021470f 100644 --- a/coin_build_instructions.py +++ b/coin_build_instructions.py @@ -122,21 +122,6 @@ def call_setup(python_ver): cmd += ["--package-timestamp=" + CI_INTEGRATION_ID] env = os.environ - if CI_HOST_OS == "MacOS": - # On Python 3, setuptools.dist.handle_display_options does some - # weird sys.stdout.detach-ing if the stdout encoding is - # different from utf-8. This causes issues when running - # subprocess.call() because that access the original stdout - # object stored in sys.__stdout__ which was detached, and - # results in an exception being thrown. - # The Coin macOS locale by default is US-ASCII, and that - # triggers the above issue. Set the encoding to UTF-8 which - # makes sure to skip over the detach-ing code. - # Relevant links to the issue: - # https://bugs.python.org/issue15216 - # https://bitbucket.org/tarek/distribute/issues/334/fix-for-311-breaks-packages-that-use - # https://github.com/pypa/virtualenv/issues/359 - env['LC_CTYPE'] = 'UTF-8' run_instruction(cmd, "Failed to run setup.py", initial_env=env) def run_build_instructions(): -- cgit v1.2.3