chore: add black for all code, no string norm

This commit is contained in:
Henry Schreiner
2021-05-03 13:12:36 -04:00
committed by Henry Schreiner
parent 5716296071
commit 9cbed6a9be
12 changed files with 39 additions and 32 deletions
+1 -2
View File
@@ -19,10 +19,9 @@ repos:
- id: isort
- repo: https://github.com/psf/black
rev: 21.4b1
rev: 21.4b2
hooks:
- id: black
files: ^bin/update_pythons.py|setup.py$
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.17.0
+1 -1
View File
@@ -180,7 +180,7 @@ def str_projects(
@click.option("--auth", help="GitHub authentication token")
@click.option("--readme", type=click.File("r+"), help="Modify a readme file if given")
def projects(
input: TextIO, online: bool, auth: str | None, readme: TextIO | None
input: TextIO, online: bool, auth: str | None, readme: TextIO | None,
) -> None:
config = yaml.safe_load(input)
output = str_projects(config, online=online, auth=auth)
+1 -1
View File
@@ -125,7 +125,7 @@ def run_example_ci_configs(config_files=None):
shutil.copyfile(src_config_file, dst_config_file)
run(['git', 'add', example_project], check=True)
message = textwrap.dedent(f'''
message = textwrap.dedent(f'''\
Test example minimal configs
Testing files: {config_files}
+1 -1
View File
@@ -22,6 +22,6 @@ if __name__ == '__main__':
subprocess.run([
sys.executable, '-m', 'test.test_projects',
options.project_python_path, project_dir
], check=True)
], check=True,)
sys.exit(subprocess.run([sys.executable, '-m', 'cibuildwheel'], cwd=project_dir).returncode)
+13 -8
View File
@@ -35,16 +35,21 @@ else:
for python_version in PYTHON_VERSIONS:
abi_flags = '' if int(python_version) >= 38 else 'm'
python_path = f'/opt/python/cp{python_version}-cp{python_version}{abi_flags}/bin/'
subprocess.run([
'docker', 'run', '--rm',
'-e', 'CUSTOM_COMPILE_COMMAND',
'-v', f'{os.getcwd()}:/volume',
'--workdir', '/volume', image_runner,
'bash', '-c',
f'{python_path}pip install pip-tools &&'
f'{python_path}pip-compile --allow-unsafe --upgrade '
command = (
f'{python_path}pip install pip-tools && '
'{python_path}pip-compile --allow-unsafe --upgrade '
'cibuildwheel/resources/constraints.in '
f'--output-file cibuildwheel/resources/constraints-python{python_version}.txt'
)
subprocess.run([
'docker', 'run',
'--rm',
'--env=CUSTOM_COMPILE_COMMAND',
"--volume={os.getcwd()}:/volume",
'--workdir=/volume',
image_runner,
'bash', '-c',
command,
], check=True)
# default constraints.txt
+5 -5
View File
@@ -105,7 +105,7 @@ def main() -> None:
parser.add_argument('--allow-empty',
action='store_true',
help='Do not report an error code if the build does not match any wheels.')
help='Do not report an error code if the build does not match any wheels.',)
args = parser.parse_args()
@@ -117,10 +117,10 @@ def main() -> None:
ci_provider = detect_ci_provider()
if ci_provider is None:
print(textwrap.dedent('''
cibuildwheel: Unable to detect platform. cibuildwheel should run on your CI server;
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.
cibuildwheel: Unable to detect platform. cibuildwheel should run on your CI server;
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)
sys.exit(2)
if sys.platform.startswith('linux'):
+2 -2
View File
@@ -7,6 +7,6 @@ requires = [
build-backend = "setuptools.build_meta"
[tool.black]
line-length = 120
target-version = ['py36', 'py37', 'py38']
line-length = 100
target-version = ['py36', 'py37', 'py38', 'py39']
skip-string-normalization = true
+1 -1
View File
@@ -52,7 +52,7 @@ include =
cibuildwheel
[flake8]
ignore = E501,W503,E741,E226,B950
ignore = E501,W503,E741,E226,B950,E203
select = C,E,F,W,B,B9
application-import-names = cibuildwheel
exclude =
+6 -4
View File
@@ -8,7 +8,7 @@ from .test_projects import TestProject
cpp_test_project = TestProject()
cpp_test_project.files['setup.py'] = jinja2.Template(r'''
setup_py_template = r'''\
from setuptools import Extension, setup
setup(
@@ -16,9 +16,9 @@ setup(
ext_modules=[Extension('spam', sources=['spam.cpp'], language="c++", extra_compile_args={{ extra_compile_args }})],
version="0.1.0",
)
''')
'''
cpp_test_project.files['spam.cpp'] = jinja2.Template(r'''
spam_cpp_template = r'''\
#include <Python.h>
{{ spam_cpp_top_level_add }}
@@ -69,8 +69,10 @@ MOD_INIT(spam)
MOD_RETURN(m)
}
''')
'''
cpp_test_project.files['setup.py'] = jinja2.Template(setup_py_template)
cpp_test_project.files['spam.cpp'] = jinja2.Template(spam_cpp_template)
cpp11_project = cpp_test_project.copy()
cpp11_project.template_context['extra_compile_args'] = (
+2 -2
View File
@@ -54,11 +54,11 @@ def test_pinned_versions(tmp_path, python_version):
if utils.platform == 'windows' and python_version == '2.7':
pytest.skip('Windows requires a workaround')
is_running_on_macos_11_or_later = (
is_macos_11_or_later = (
utils.platform == 'macos' and utils.get_macos_version() >= (10, 16)
)
if is_running_on_macos_11_or_later and python_version == '3.5':
if is_macos_11_or_later and python_version == '3.5':
pytest.skip('CPython 3.5 doesn\'t work on macOS Big Sur+')
project_dir = tmp_path / 'project'
+4 -4
View File
@@ -8,10 +8,10 @@ from . import test_projects, utils
basic_project = test_projects.new_c_project()
ALL_MACOS_WHEELS = (
utils.expected_wheels('spam', '0.1.0', machine_arch='x86_64')
+ utils.expected_wheels('spam', '0.1.0', machine_arch='arm64')
)
ALL_MACOS_WHEELS = {
*utils.expected_wheels('spam', '0.1.0', machine_arch='x86_64'),
*utils.expected_wheels('spam', '0.1.0', machine_arch='arm64')
}
def get_xcode_version() -> Tuple[int, int]:
+2 -1
View File
@@ -64,7 +64,8 @@ def test(manylinux_image, tmp_path):
add_env['CIBW_SKIP'] = 'pp*'
elif manylinux_image in {'manylinux2014', 'manylinux_2_24'}:
# We don't have a manylinux2014 / 'manylinux_2_24' image for PyPy (yet?)
add_env['CIBW_SKIP'] = 'cp27* pp*' # Python 2.7 not available on manylinux2014 / 'manylinux_2_24'
# Python 2.7 not available on manylinux2014 / 'manylinux_2_24'
add_env['CIBW_SKIP'] = 'cp27* pp*'
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0', manylinux_versions=[manylinux_image])]