diff --git a/bin/make_dependency_update_pr.py b/bin/make_dependency_update_pr.py index 1c409fed..6b9dca1a 100755 --- a/bin/make_dependency_update_pr.py +++ b/bin/make_dependency_update_pr.py @@ -52,10 +52,10 @@ def main(): shell('git commit -a -m "Update dependencies"', check=True) body = textwrap.dedent( f''' - Update the versions of our dependencies. + Update the versions of our dependencies. - PR generated by `{os.path.basename(__file__)}`. - ''' + PR generated by `{os.path.basename(__file__)}`. + ''' ) run( [ diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index 56530bee..34447c19 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -79,13 +79,13 @@ def main() -> None: choices=['auto', 'linux', 'macos', 'windows'], default=os.environ.get('CIBW_PLATFORM', 'auto'), help=''' - Platform to build for. For "linux" you need docker running, on Mac - or Linux. For "macos", you need a Mac machine, and note that this - script is going to automatically install MacPython on your system, - so don't run on your development machine. For "windows", you need to - run in Windows, and it will build and test for all versions of - Python. Default: auto. - ''', + Platform to build for. For "linux" you need docker running, on Mac + or Linux. For "macos", you need a Mac machine, and note that this + script is going to automatically install MacPython on your system, + so don't run on your development machine. For "windows", you need to + run in Windows, and it will build and test for all versions of + Python. Default: auto. + ''', ) arch_list_str = ", ".join(a.name for a in Architecture) @@ -93,13 +93,13 @@ def main() -> None: '--archs', default=None, help=f''' - Comma-separated list of CPU architectures to build for. - When set to 'auto', builds the architectures natively supported - on this machine. Set this option to build an architecture - via emulation, for example, using binfmt_misc and QEMU. - Default: auto. - Choices: auto, auto64, auto32, native, all, {arch_list_str} - ''', + Comma-separated list of CPU architectures to build for. + When set to 'auto', builds the architectures natively supported + on this machine. Set this option to build an architecture + via emulation, for example, using binfmt_misc and QEMU. + Default: auto. + Choices: auto, auto64, auto32, native, all, {arch_list_str} + ''', ) parser.add_argument( @@ -113,11 +113,11 @@ def main() -> None: default='.', nargs='?', help=''' - Path to the package that you want wheels for. Must be a subdirectory of - the working directory. When set, the working directory is still - considered the 'project' and is copied into the Docker container on - Linux. Default: the working directory. - ''', + Path to the package that you want wheels for. Must be a subdirectory of + the working directory. When set, the working directory is still + considered the 'project' and is copied into the Docker container on + Linux. Default: the working directory. + ''', ) parser.add_argument( @@ -148,7 +148,7 @@ def main() -> None: Travis CI, AppVeyor, Azure Pipelines, GitHub Actions, CircleCI, and Gitlab are supported. You can run on your development machine or other CI providers using the --platform argument. Check --help output for more information. - ''' + ''' ), file=sys.stderr, ) @@ -387,11 +387,11 @@ def print_preamble(platform: str, build_options: BuildOptions) -> None: print( textwrap.dedent( ''' - _ _ _ _ _ _ _ - ___|_| |_ _ _|_| |_| |_ _ _| |_ ___ ___| | - | _| | . | | | | | . | | | | | -_| -_| | - |___|_|___|___|_|_|___|_____|_|_|___|___|_| - ''' + _ _ _ _ _ _ _ + ___|_| |_ _ _|_| |_| |_ _ _| |_ ___ ___| | + | _| | . | | | | | . | | | | | -_| -_| | + |___|_|___|___|_|_|___|_____|_|_|___|___|_| + ''' ) ) diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index 258c4fe8..78d9a7c3 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -319,14 +319,14 @@ def troubleshoot(package_dir: Path, error: Exception) -> None: print( textwrap.dedent( ''' - NOTE: Shared object (.so) files found in this project. + NOTE: Shared object (.so) files found in this project. - These files might be built against the wrong OS, causing problems with - auditwheel. + These files might be built against the wrong OS, causing problems with + auditwheel. - If you're using Cython and have previously done an in-place build, - remove those build files (*.so and *.c) before starting cibuildwheel. - ''' + If you're using Cython and have previously done an in-place build, + remove those build files (*.so and *.c) before starting cibuildwheel. + ''' ), file=sys.stderr, ) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index a8a07b49..9af3d8e3 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -101,10 +101,10 @@ def get_python_configurations( log.warning( unwrap( ''' - 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. - ''' + 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 = [ @@ -116,10 +116,10 @@ def get_python_configurations( log.warning( unwrap( ''' - CPython 3.5 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. - ''' + CPython 3.5 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 = [ @@ -326,7 +326,7 @@ def setup_python( ''' SDK for building arm64-compatible wheels not found. You need Xcode 12.2 or later to build universal2 or arm64 wheels. - ''' + ''' ) ) else: @@ -465,23 +465,25 @@ def build(options: BuildOptions) -> None: log.warning( unwrap( ''' - While arm64 wheels can be built on x86_64, they cannot be tested. The - ability to test the arm64 wheels will be added in a future release of - cibuildwheel, once Apple Silicon CI runners are widely available. To - silence this warning, set `CIBW_TEST_SKIP: *-macosx_arm64`. - ''' + While arm64 wheels can be built on x86_64, they cannot be + tested. The ability to test the arm64 wheels will be added in a + future release of cibuildwheel, once Apple Silicon CI runners + are widely available. To silence this warning, set + `CIBW_TEST_SKIP: *-macosx_arm64`. + ''' ) ) elif config_is_universal2: log.warning( unwrap( ''' - While universal2 wheels can be built on x86_64, the arm64 part of them - cannot currently be tested. The ability to test the arm64 part of a - universal2 wheel will be added in a future release of cibuildwheel, once - Apple Silicon CI runners are widely available. To silence this warning, - set `CIBW_TEST_SKIP: *-macosx_universal2:arm64`. - ''' + While universal2 wheels can be built on x86_64, the arm64 part + of them cannot currently be tested. The ability to test the + arm64 part of a universal2 wheel will be added in a future + release of cibuildwheel, once Apple Silicon CI runners are + widely available. To silence this warning, set + `CIBW_TEST_SKIP: *-macosx_universal2:arm64`. + ''' ) ) else: diff --git a/cibuildwheel/util.py b/cibuildwheel/util.py index 88817f5c..3991e19a 100644 --- a/cibuildwheel/util.py +++ b/cibuildwheel/util.py @@ -206,7 +206,7 @@ class NonPlatformWheelError(Exception): If you expected a platform wheel, check your project configuration, or run cibuildwheel with CIBW_BUILD_VERBOSITY=1 to view build logs. - ''' + ''' ) super().__init__(message) diff --git a/test/test_0_basic.py b/test/test_0_basic.py index d43f7b5a..b382c103 100644 --- a/test/test_0_basic.py +++ b/test/test_0_basic.py @@ -14,7 +14,7 @@ basic_project = test_projects.new_c_project( if os.environ.get("CIBUILDWHEEL", "0") != "1": raise Exception("CIBUILDWHEEL environment variable is not set to 1") - ''' + ''' ) ) diff --git a/test/test_before_all.py b/test/test_before_all.py index a094ce38..3aa58715 100644 --- a/test/test_before_all.py +++ b/test/test_before_all.py @@ -15,7 +15,7 @@ project_with_before_build_asserts = test_projects.new_c_project( print("## stored text: " + stored_text) assert stored_text == "sample text 123" - ''' + ''' ) ) diff --git a/test/test_before_build.py b/test/test_before_build.py index 9b04481a..bd65d4a8 100644 --- a/test/test_before_build.py +++ b/test/test_before_build.py @@ -27,7 +27,7 @@ project_with_before_build_asserts = test_projects.new_c_project( print('sys.executable', sys.executable) # windows/mac are case insensitive assert os.path.realpath(stored_executable).lower() == os.path.realpath(sys.executable).lower() - ''' + ''' ) ) diff --git a/test/test_build_skip.py b/test/test_build_skip.py index 1e96344d..dcc66dce 100644 --- a/test/test_build_skip.py +++ b/test/test_build_skip.py @@ -10,7 +10,7 @@ project_with_skip_asserts = test_projects.new_c_project( raise Exception("Python 2.7 should not be built") if sys.version_info[0:2] == (3, 7): raise Exception("Python 3.7 should be skipped") - ''' + ''' ) ) diff --git a/test/test_cpp_standards.py b/test/test_cpp_standards.py index f0517473..e4796145 100644 --- a/test/test_cpp_standards.py +++ b/test/test_cpp_standards.py @@ -8,7 +8,7 @@ from .test_projects import TestProject cpp_test_project = TestProject() -setup_py_template = r'''\ +setup_py_template = r''' from setuptools import Extension, setup setup( @@ -18,7 +18,7 @@ setup( ) ''' -spam_cpp_template = r'''\ +spam_cpp_template = r''' #include {{ spam_cpp_top_level_add }} diff --git a/test/test_dependency_versions.py b/test/test_dependency_versions.py index 106ecb20..315be764 100644 --- a/test/test_dependency_versions.py +++ b/test/test_dependency_versions.py @@ -31,7 +31,7 @@ project_with_expected_version_checks = test_projects.new_c_project( assert '{}=={}'.format(package_name, expected_version) in versions, ( 'error: {} version should equal {}'.format(package_name, expected_version) ) - ''' + ''' ) ) @@ -148,7 +148,7 @@ def test_dependency_constraints_file(tmp_path, python_version): setuptools=={setuptools} wheel=={wheel} virtualenv=={virtualenv} - '''.format( + '''.format( **tool_versions ) ) diff --git a/test/test_docker_images.py b/test/test_docker_images.py index 0790906f..fdce5121 100644 --- a/test/test_docker_images.py +++ b/test/test_docker_images.py @@ -16,7 +16,7 @@ dockcross_only_project = test_projects.new_c_project( raise Exception( "/dockcross directory not found. Is this test running in the correct docker image?" ) - ''' + ''' ) ) diff --git a/test/test_environment.py b/test/test_environment.py index f165fce2..f2fe3b01 100644 --- a/test/test_environment.py +++ b/test/test_environment.py @@ -27,7 +27,7 @@ project_with_environment_asserts = test_projects.new_c_project( raise Exception('PATH should contain "/opt/cibw_test_path". It was "%s"' % PATH) if "$PATH" in PATH: raise Exception('$PATH should be expanded in PATH. It was "%s"' % PATH) - ''' + ''' ) ) diff --git a/test/test_manylinuxXXXX_only.py b/test/test_manylinuxXXXX_only.py index 4432fe27..88ea9cde 100644 --- a/test/test_manylinuxXXXX_only.py +++ b/test/test_manylinuxXXXX_only.py @@ -21,7 +21,7 @@ project_with_manylinux_symbols = test_projects.new_c_project( #if !__GLIBC_PREREQ(2, 5) /* manylinux1 is glibc 2.5 */ #error "Must run on a glibc >= 2.5 linux environment" #endif - ''' + ''' ), spam_c_function_add=textwrap.dedent( r''' @@ -35,7 +35,7 @@ project_with_manylinux_symbols = test_projects.new_c_project( // malloc_info is only available on manylinux2010+ sts = malloc_info(0, stdout); #endif - ''' + ''' ), ) diff --git a/test/test_projects/__main__.py b/test/test_projects/__main__.py index e0fed58e..417d812e 100644 --- a/test/test_projects/__main__.py +++ b/test/test_projects/__main__.py @@ -13,22 +13,16 @@ def main(): parser.add_argument( '--open', action='store_true', - help=''' - Open the generated project in a file explorer - ''', + help='Open the generated project in a file explorer', ) parser.add_argument( 'PROJECT', - help=''' - Python path to a project object. E.g. test.test_0_basic.basic_project - ''', + help='Python path to a project object. E.g. test.test_0_basic.basic_project', ) parser.add_argument( 'OUTPUT', nargs='?', - help=''' - Path to output dir. If no dir is passed, a tempdir will be generated. - ''', + help='Path to output dir. If no dir is passed, a tempdir will be generated.', ) options = parser.parse_args() diff --git a/test/test_ssl.py b/test/test_ssl.py index 8b10b4c8..5d4c8297 100644 --- a/test/test_ssl.py +++ b/test/test_ssl.py @@ -16,7 +16,7 @@ project_with_ssl_tests = test_projects.new_c_project( data = urlopen("https://www.nist.gov", context=context) data = urlopen("https://raw.githubusercontent.com/joerick/cibuildwheel/master/CI.md", context=context) data = urlopen("https://raw.githubusercontent.com/joerick/cibuildwheel/master/CI.md") - ''' + ''' ) ) diff --git a/test/test_testing.py b/test/test_testing.py index 2ef751c8..deb49b23 100644 --- a/test/test_testing.py +++ b/test/test_testing.py @@ -11,7 +11,7 @@ project_with_a_test = test_projects.new_c_project( r''' [options.extras_require] test = nose - ''' + ''' ) ) diff --git a/test/test_unicode.py b/test/test_unicode.py index b924be9e..f5743c2d 100644 --- a/test/test_unicode.py +++ b/test/test_unicode.py @@ -10,7 +10,7 @@ project_with_unicode = test_projects.new_c_project( { Py_XDECREF(PyUnicode_FromStringAndSize("foo", 4)); } - ''' + ''' ), ) diff --git a/unit_test/docker_container_test.py b/unit_test/docker_container_test.py index bf608e9b..bdde875a 100644 --- a/unit_test/docker_container_test.py +++ b/unit_test/docker_container_test.py @@ -107,9 +107,9 @@ def test_binary_output(): '-c', textwrap.dedent( ''' - import sys - sys.stdout.write(''.join(chr(n) for n in range(0, 256))) - ''' + import sys + sys.stdout.write(''.join(chr(n) for n in range(0, 256))) + ''' ), ] ) @@ -121,9 +121,9 @@ def test_binary_output(): '-c', textwrap.dedent( ''' - import sys - sys.stdout.write(''.join(chr(n % 256) for n in range(0, 512))) - ''' + import sys + sys.stdout.write(''.join(chr(n % 256) for n in range(0, 512))) + ''' ), ], capture_output=True, diff --git a/unit_test/main_tests/main_requires_python_test.py b/unit_test/main_tests/main_requires_python_test.py index 26b5333f..df8540cd 100644 --- a/unit_test/main_tests/main_requires_python_test.py +++ b/unit_test/main_tests/main_requires_python_test.py @@ -53,9 +53,9 @@ def test_override_setup_cfg(platform, monkeypatch, intercepted_build_args, fake_ fake_package_dir.joinpath("setup.cfg").write_text( textwrap.dedent( """ - [options] - python_requires = >=3.8 - """ + [options] + python_requires = >=3.8 + """ ) ) @@ -74,9 +74,9 @@ def test_override_pyproject_toml(platform, monkeypatch, intercepted_build_args, fake_package_dir.joinpath("pyproject.toml").write_text( textwrap.dedent( """ - [project] - requires-python = ">=3.8" - """ + [project] + requires-python = ">=3.8" + """ ) ) @@ -95,13 +95,13 @@ def test_override_setup_py_simple(platform, monkeypatch, intercepted_build_args, fake_package_dir.joinpath("setup.py").write_text( textwrap.dedent( """ - from setuptools import setup + from setuptools import setup - setup( - name = "other", - python_requires = ">=3.7", - ) - """ + setup( + name = "other", + python_requires = ">=3.7", + ) + """ ) ) diff --git a/unit_test/projectfiles_test.py b/unit_test/projectfiles_test.py index bc9a7a54..c62df6a9 100644 --- a/unit_test/projectfiles_test.py +++ b/unit_test/projectfiles_test.py @@ -8,15 +8,15 @@ def test_read_setup_py_simple(tmp_path): f.write( dedent( """ - from setuptools import setup + from setuptools import setup - setup( - name = "hello", - other = 23, - example = ["item", "other"], - python_requires = "1.23", - ) - """ + setup( + name = "hello", + other = 23, + example = ["item", "other"], + python_requires = "1.23", + ) + """ ) ) @@ -29,17 +29,17 @@ def test_read_setup_py_full(tmp_path): f.write( dedent( """ - import setuptools + import setuptools - setuptools.randomfunc() + setuptools.randomfunc() - setuptools.setup( - name = "hello", - other = 23, - example = ["item", "other"], - python_requires = "1.24", - ) - """ + setuptools.setup( + name = "hello", + other = 23, + example = ["item", "other"], + python_requires = "1.24", + ) + """ ) ) @@ -52,17 +52,17 @@ def test_read_setup_py_assign(tmp_path): f.write( dedent( """ - from setuptools import setup + from setuptools import setup - REQUIRES = "3.21" + REQUIRES = "3.21" - setuptools.setup( - name = "hello", - other = 23, - example = ["item", "other"], - python_requires = REQUIRES, - ) - """ + setuptools.setup( + name = "hello", + other = 23, + example = ["item", "other"], + python_requires = REQUIRES, + ) + """ ) ) @@ -75,17 +75,17 @@ def test_read_setup_py_None(tmp_path): f.write( dedent( """ - from setuptools import setup + from setuptools import setup - REQUIRES = None + REQUIRES = None - setuptools.setup( - name = "hello", - other = 23, - example = ["item", "other"], - python_requires = None, - ) - """ + setuptools.setup( + name = "hello", + other = 23, + example = ["item", "other"], + python_requires = None, + ) + """ ) ) @@ -98,16 +98,16 @@ def test_read_setup_py_empty(tmp_path): f.write( dedent( """ - from setuptools import setup + from setuptools import setup - REQUIRES = "3.21" + REQUIRES = "3.21" - setuptools.setup( - name = "hello", - other = 23, - example = ["item", "other"], - ) - """ + setuptools.setup( + name = "hello", + other = 23, + example = ["item", "other"], + ) + """ ) ) @@ -120,11 +120,11 @@ def test_read_setup_cfg(tmp_path): f.write( dedent( """ - [options] - python_requires = 1.234 - [metadata] - something = other - """ + [options] + python_requires = 1.234 + [metadata] + something = other + """ ) ) @@ -136,11 +136,11 @@ def test_read_setup_cfg_empty(tmp_path): f.write( dedent( """ - [options] - other = 1.234 - [metadata] - something = other - """ + [options] + other = 1.234 + [metadata] + something = other + """ ) ) @@ -152,12 +152,12 @@ def test_read_pyproject_toml(tmp_path): f.write( dedent( """ - [project] - requires-python = "1.654" + [project] + requires-python = "1.654" - [tool.cibuildwheel] - something = "other" - """ + [tool.cibuildwheel] + something = "other" + """ ) ) @@ -169,9 +169,9 @@ def test_read_pyproject_toml_empty(tmp_path): f.write( dedent( """ - [project] - other = 1.234 - """ + [project] + other = 1.234 + """ ) )