style: apply black via pre-commit run -a

This commit is contained in:
Henry Schreiner
2021-05-03 13:12:36 -04:00
committed by Henry Schreiner
parent 9cbed6a9be
commit 178aaea6c7
53 changed files with 1479 additions and 714 deletions
+16 -11
View File
@@ -64,7 +64,7 @@ services = [
CIService(
name='gitlab',
dst_config_path='.gitlab-ci.yml',
badge_md='[![Gitlab](https://gitlab.com/joerick/cibuildwheel/badges/{branch}/pipeline.svg)](https://gitlab.com/joerick/cibuildwheel/-/commits/{branch})'
badge_md='[![Gitlab](https://gitlab.com/joerick/cibuildwheel/badges/{branch}/pipeline.svg)](https://gitlab.com/joerick/cibuildwheel/-/commits/{branch})',
),
]
@@ -83,8 +83,8 @@ def ci_service_for_config_file(config_file):
@click.argument('config_files', nargs=-1, type=click.Path())
def run_example_ci_configs(config_files=None):
'''
Test the example configs. If no files are specified, will test
examples/*-minimal.yml
Test the example configs. If no files are specified, will test
examples/*-minimal.yml
'''
if len(config_files) == 0:
@@ -102,10 +102,9 @@ def run_example_ci_configs(config_files=None):
print('Your git repo has uncommitted changes. Commit or stash before continuing.')
sys.exit(1)
previous_branch = shell('git rev-parse --abbrev-ref HEAD',
check=True,
capture_output=True,
encoding='utf8').stdout.strip()
previous_branch = shell(
'git rev-parse --abbrev-ref HEAD', check=True, capture_output=True, encoding='utf8'
).stdout.strip()
timestamp = time.strftime('%Y-%m-%dT%H-%M-%S', time.gmtime())
branch_name = f'example-config-test---{previous_branch}-{timestamp}'
@@ -125,13 +124,15 @@ 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}
Generated from branch: {previous_branch}
Time: {timestamp}
''')
'''
)
run(['git', 'commit', '--no-verify', '--message', message], check=True)
shell(f'git subtree --prefix={example_project} push origin {branch_name}', check=True)
@@ -139,13 +140,17 @@ def run_example_ci_configs(config_files=None):
print()
print('> **Examples test run**')
print('> ')
print(f'> Branch: [{branch_name}](https://github.com/joerick/cibuildwheel/tree/{branch_name})')
print(
f'> Branch: [{branch_name}](https://github.com/joerick/cibuildwheel/tree/{branch_name})'
)
print('> ')
print('> | Service | Config | Status |')
print('> |---|---|---|')
for config_file in config_files:
service = ci_service_for_config_file(config_file)
badge = service.badge_md.format(branch=branch_name, branch_escaped=quote(branch_name, safe=''))
badge = service.badge_md.format(
branch=branch_name, branch_escaped=quote(branch_name, safe='')
)
print(f'> | {service.name} | `{config_file}` | {badge} |')
print('> ')
print('> Generated by `bin/run_example_ci_config.py`')