ci: run black on Python scripts (#1094)

* ci: run black on Python scripts

* comments
This commit is contained in:
Clement Tsang 2023-04-11 04:57:29 -04:00 committed by GitHub
parent 016fa1e19b
commit 857b5bade0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 7 deletions

View File

@ -3,7 +3,7 @@
# Configuration for CirrusCI. This is primarily used for testing and building FreeBSD and macOS M1, since other
# CI platforms don't seem to support these platforms as of writing.
#
# We set the YAML directive above to prevent some linting errors around the
# Note that we set the YAML directive above to prevent some linting errors around the
# templates.
setup_template: &SETUP_TEMPLATE

View File

@ -31,7 +31,9 @@ def make_query_request(key: str, branch: str, build_type: str):
# Dumb but if it works...
config_override = (
Path(".cirrus.yml").read_text().replace("# -PLACEHOLDER FOR CI-", 'BTM_BUILD_RELEASE_CALLER: "nightly"')
Path(".cirrus.yml")
.read_text()
.replace("# -PLACEHOLDER FOR CI-", 'BTM_BUILD_RELEASE_CALLER: "nightly"')
)
query = """
mutation CreateCirrusCIBuild (
@ -102,7 +104,7 @@ def check_build_status(key: str, id: str) -> Optional[str]:
def try_download(build_id: str, dl_path: Path):
for (task, file) in TASKS:
for task, file in TASKS:
url = DL_URL_TEMPLATE % (build_id, task, file)
out = dl_path / file
print("Downloading {} to {}".format(file, out))
@ -187,9 +189,14 @@ def main():
print("Unexpected error:")
print(ex)
print(traceback.format_exc())
sleep(60) # Sleep for a minute if something went wrong, just in case.
# Sleep for a minute if something went wrong, just in case.
sleep(60)
else:
print("Build failed to complete after {} minutes, bailing.".format(MINUTES))
print(
"Build failed to complete after {} minutes, bailing.".format(
MINUTES
)
)
if not success:
exit(2)

View File

@ -34,7 +34,10 @@ def get_hash(deployment_file):
elif str.lower(hash_type) == "sha1":
deployment_hash = hashlib.sha1(deployment_file.read()).hexdigest()
else:
print('Unsupported hash format "%s". Please use SHA512, SHA256, or SHA1.', hash_type)
print(
'Unsupported hash format "%s". Please use SHA512, SHA256, or SHA1.',
hash_type,
)
exit(1)
print("Generated hash: %s" % str(deployment_hash))

View File

@ -43,7 +43,9 @@ with open(deployment_file_path_64, "rb") as deployment_file_64:
with open(ps1_template, "r") as template_file:
template = Template(template_file.read())
substitute = template.safe_substitute(version=version, hash_64=hash_64)
print("\n================== Generated chocolatey-install file ==================\n")
print(
"\n================== Generated chocolatey-install file ==================\n"
)
print(substitute)
print("\n============================================================\n")