mirror of
https://github.com/ClementTsang/bottom
synced 2025-02-16 13:18:28 +00:00
ci: run black on Python scripts (#1094)
* ci: run black on Python scripts * comments
This commit is contained in:
parent
016fa1e19b
commit
857b5bade0
4 changed files with 19 additions and 7 deletions
|
@ -3,7 +3,7 @@
|
||||||
# Configuration for CirrusCI. This is primarily used for testing and building FreeBSD and macOS M1, since other
|
# 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.
|
# 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.
|
# templates.
|
||||||
|
|
||||||
setup_template: &SETUP_TEMPLATE
|
setup_template: &SETUP_TEMPLATE
|
||||||
|
|
|
@ -31,7 +31,9 @@ def make_query_request(key: str, branch: str, build_type: str):
|
||||||
|
|
||||||
# Dumb but if it works...
|
# Dumb but if it works...
|
||||||
config_override = (
|
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 = """
|
query = """
|
||||||
mutation CreateCirrusCIBuild (
|
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):
|
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)
|
url = DL_URL_TEMPLATE % (build_id, task, file)
|
||||||
out = dl_path / file
|
out = dl_path / file
|
||||||
print("Downloading {} to {}".format(file, out))
|
print("Downloading {} to {}".format(file, out))
|
||||||
|
@ -187,9 +189,14 @@ def main():
|
||||||
print("Unexpected error:")
|
print("Unexpected error:")
|
||||||
print(ex)
|
print(ex)
|
||||||
print(traceback.format_exc())
|
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:
|
else:
|
||||||
print("Build failed to complete after {} minutes, bailing.".format(MINUTES))
|
print(
|
||||||
|
"Build failed to complete after {} minutes, bailing.".format(
|
||||||
|
MINUTES
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if not success:
|
if not success:
|
||||||
exit(2)
|
exit(2)
|
||||||
|
|
|
@ -34,7 +34,10 @@ def get_hash(deployment_file):
|
||||||
elif str.lower(hash_type) == "sha1":
|
elif str.lower(hash_type) == "sha1":
|
||||||
deployment_hash = hashlib.sha1(deployment_file.read()).hexdigest()
|
deployment_hash = hashlib.sha1(deployment_file.read()).hexdigest()
|
||||||
else:
|
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)
|
exit(1)
|
||||||
|
|
||||||
print("Generated hash: %s" % str(deployment_hash))
|
print("Generated hash: %s" % str(deployment_hash))
|
||||||
|
|
|
@ -43,7 +43,9 @@ with open(deployment_file_path_64, "rb") as deployment_file_64:
|
||||||
with open(ps1_template, "r") as template_file:
|
with open(ps1_template, "r") as template_file:
|
||||||
template = Template(template_file.read())
|
template = Template(template_file.read())
|
||||||
substitute = template.safe_substitute(version=version, hash_64=hash_64)
|
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(substitute)
|
||||||
print("\n============================================================\n")
|
print("\n============================================================\n")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue