Print warnings when builds are deselected because of build OS
This commit is contained in:
@@ -113,6 +113,18 @@ class Logger:
|
|||||||
|
|
||||||
def step_end_with_error(self, error: Union[BaseException, str]) -> None:
|
def step_end_with_error(self, error: Union[BaseException, str]) -> None:
|
||||||
self.step_end(success=False)
|
self.step_end(success=False)
|
||||||
|
self.error(error)
|
||||||
|
|
||||||
|
def warning(self, message: str) -> None:
|
||||||
|
print()
|
||||||
|
|
||||||
|
if self.fold_mode == 'github':
|
||||||
|
print(f'::warning::{message}')
|
||||||
|
else:
|
||||||
|
c = self.colors
|
||||||
|
print(f'{c.yellow}Warning{c.end} {message}')
|
||||||
|
|
||||||
|
def error(self, error: Union[BaseException, str]) -> None:
|
||||||
print()
|
print()
|
||||||
|
|
||||||
if self.fold_mode == 'github':
|
if self.fold_mode == 'github':
|
||||||
|
|||||||
+19
-3
@@ -13,7 +13,7 @@ from .environment import ParsedEnvironment
|
|||||||
from .logger import log
|
from .logger import log
|
||||||
from .util import (Architecture, BuildOptions, BuildSelector, NonPlatformWheelError,
|
from .util import (Architecture, BuildOptions, BuildSelector, NonPlatformWheelError,
|
||||||
download, get_build_verbosity_extra_flags, get_pip_script,
|
download, get_build_verbosity_extra_flags, get_pip_script,
|
||||||
install_certifi_script, prepare_command)
|
install_certifi_script, prepare_command, wrap_text)
|
||||||
from .typing import PathOrStr
|
from .typing import PathOrStr
|
||||||
|
|
||||||
|
|
||||||
@@ -64,16 +64,32 @@ def get_python_configurations(build_selector: BuildSelector) -> List[PythonConfi
|
|||||||
PythonConfiguration(version='3.7', identifier='pp37-macosx_x86_64', url='https://downloads.python.org/pypy/pypy3.7-v7.3.3-osx64.tar.bz2'),
|
PythonConfiguration(version='3.7', identifier='pp37-macosx_x86_64', url='https://downloads.python.org/pypy/pypy3.7-v7.3.3-osx64.tar.bz2'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# skip builds as required
|
||||||
|
python_configurations = [c for c in python_configurations if build_selector(c.identifier)]
|
||||||
|
|
||||||
if get_macos_version() >= (11, 0):
|
if get_macos_version() >= (11, 0):
|
||||||
# pypy doesn't work on macOS 11 yet
|
# pypy doesn't work on macOS 11 yet
|
||||||
# See https://foss.heptapod.net/pypy/pypy/-/issues/3314
|
# See https://foss.heptapod.net/pypy/pypy/-/issues/3314
|
||||||
|
if any(c.identifier.startswith('pp') for c in python_configurations):
|
||||||
|
log.warning(wrap_text('''
|
||||||
|
PyPy is currently unsupported when building on macOS 11. To build macOS PyPy wheels,
|
||||||
|
build on an older OS, such as macOS 10.15. To silence this warning, deselect PyPy by
|
||||||
|
adding "pp*-macosx*" to your CIBW_SKIP option.
|
||||||
|
'''))
|
||||||
python_configurations = [c for c in python_configurations if not c.identifier.startswith('pp')]
|
python_configurations = [c for c in python_configurations if not c.identifier.startswith('pp')]
|
||||||
|
|
||||||
|
if any(c.identifier.startswith('cp35') for c in python_configurations):
|
||||||
# CPython 3.5 doesn't work on macOS 11
|
# CPython 3.5 doesn't work on macOS 11
|
||||||
|
log.warning(wrap_text('''
|
||||||
|
CPython is unsupported when building on macOS 11. To build CPython 3.5 wheels, build
|
||||||
|
on an older OS, such as macOS 10.15. To silence this warning, deselect CPython 3.5
|
||||||
|
by adding "cp35-macosx_x86_64" to your CIBW_SKIP option.
|
||||||
|
'''))
|
||||||
python_configurations = [c for c in python_configurations if not c.identifier.startswith('cp35')]
|
python_configurations = [c for c in python_configurations if not c.identifier.startswith('cp35')]
|
||||||
|
|
||||||
# skip builds as required
|
python_configurations = [c for c in python_configurations if not c.identifier.startswith('cp35')]
|
||||||
return [c for c in python_configurations if build_selector(c.identifier)]
|
|
||||||
|
return python_configurations
|
||||||
|
|
||||||
|
|
||||||
SYMLINKS_DIR = Path('/tmp/cibw_bin')
|
SYMLINKS_DIR = Path('/tmp/cibw_bin')
|
||||||
|
|||||||
@@ -229,3 +229,17 @@ def detect_ci_provider() -> Optional[CIProvider]:
|
|||||||
return CIProvider.other
|
return CIProvider.other
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def wrap_text(text: str, max_width: int = 80) -> str:
|
||||||
|
'''
|
||||||
|
Formats text, suitable for printing arbitrary long passages to console.
|
||||||
|
'''
|
||||||
|
# remove initial line indent
|
||||||
|
text = textwrap.dedent(text)
|
||||||
|
# remove leading/trailing whitespace
|
||||||
|
text = text.strip()
|
||||||
|
# remove consecutive whitespace
|
||||||
|
text = re.sub(r'\s+', ' ', text)
|
||||||
|
# wrap to max_width
|
||||||
|
return '\n'.join(textwrap.wrap(text, width=max_width))
|
||||||
|
|||||||
Reference in New Issue
Block a user