Route warnings and error messages to stderr, not stdout.

This commit is contained in:
Joe Rickerby
2021-01-08 17:25:07 +00:00
parent a99726f477
commit dbb6d80a72
2 changed files with 5 additions and 16 deletions
+4 -12
View File
@@ -116,26 +116,18 @@ class Logger:
self.error(error) self.error(error)
def warning(self, message: str) -> None: def warning(self, message: str) -> None:
print()
if self.fold_mode == 'github': if self.fold_mode == 'github':
print(f'::warning::{message}') print(f'::warning::{message}\n', file=sys.stderr)
else: else:
c = self.colors c = self.colors
print(f'{c.yellow}Warning{c.end} {message}') print(f'{c.yellow}Warning{c.end}: {message}\n', file=sys.stderr)
print()
def error(self, error: Union[BaseException, str]) -> None: def error(self, error: Union[BaseException, str]) -> None:
print()
if self.fold_mode == 'github': if self.fold_mode == 'github':
print(f'::error::{error}') print(f'::error::{error}\n', file=sys.stderr)
else: else:
c = self.colors c = self.colors
print(f'{c.bright_red}Error{c.end} {error}') print(f'{c.bright_red}Error{c.end}: {error}\n', file=sys.stderr)
print()
def _start_fold_group(self, name: str) -> None: def _start_fold_group(self, name: str) -> None:
self._end_fold_group() self._end_fold_group()
+1 -4
View File
@@ -37,10 +37,7 @@ def cibuildwheel_get_build_identifiers(project_path, env=None):
env=env, env=env,
) )
lines = cmd_output.strip().split('\n') return cmd_output.strip().split('\n')
# ignore warning lines in output
return [l for l in lines if l != '' and not l.startswith('Warning ')]
def cibuildwheel_run(project_path, package_dir='.', env=None, add_env=None, output_dir=None): def cibuildwheel_run(project_path, package_dir='.', env=None, add_env=None, output_dir=None):