mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-12 02:01:29 -10:00
* Document things * Maybe use a format that doxygen can understand * Use dict comprehension to clean up main.groups a bit * More docstrings * Move FileGroup into module its supposed to be in * Remove nightly-trigger.yml * Rename workflow files to better describe their actions * Re-add post build capabilities * Post-build may be triggered by build-release.yaml or manually * minor doc update to file_list.get_ftp_files() * Maybe fix yaml errors * "You have a syntax error on L345" Gee, thanks github debugger. Could you tell me what exactly that error may be? * More fixes * More fixes * fix typo * fix typo * Allow manual trigger to specify releaseTag * Try omitting the default for string * Use correct .inputs member * try environment instead of env * Try elevating scope of env * Comment out stuff to directly test env passing * See if echo is working correctly * Test if top level env is in scope * Try github.event instead of github.events * Uncomment lines, use correct context signature * Pass ref_name to post-build-release workflow * Fix arguments to git Stash linux package since it can fail, too * str and repr cannot be compared * Get repo metadata differently to allow tests on forks * echo repository var * config["templates"] does not have a member ["installer"] so... we'll use ["release"] instead * debug render_installer_config. file groups malformed? * Print out both keys of groups dict * debug get_release_files. print binary_file list * Revert file_list debug print Try sorting binary_files by ReleaseFile.name * Add checks before running mako to improve debugging QoL * revert change to installer.py * maybe fix call to render_nebula_release * type the files argument to get IDE hints * Revert typing.... :( * missing parenthesis * Disabled installer mako rendering * Error check in ForumAPI to allow tests to continue * debug print hlp forum key stuff * Instead of none, check ""
47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
# miscellaneous utilities
|
|
|
|
import os
|
|
import time
|
|
from functools import wraps
|
|
|
|
from requests import RequestException
|
|
|
|
GLOBAL_TIMEOUT = 30
|
|
|
|
def retry_multi(max_retries):
|
|
"""!
|
|
@brief Decorator - Retry a function `max_retries` times.
|
|
|
|
@param [in] `max_retries` Maximum number of times to retry the decorated function before giving up
|
|
|
|
@details Intended for use with functions from the `request` module, only catches `RequestException`'s
|
|
@note This has been copied from https://stackoverflow.com/a/23892489
|
|
"""
|
|
|
|
def retry(func):
|
|
@wraps(func)
|
|
def wrapper(*args, **kwargs):
|
|
num_retries = 0
|
|
while num_retries <= max_retries:
|
|
try:
|
|
ret = func(*args, **kwargs)
|
|
break
|
|
except RequestException:
|
|
if num_retries == max_retries:
|
|
raise
|
|
num_retries += 1
|
|
time.sleep(5)
|
|
return ret
|
|
|
|
return wrapper
|
|
|
|
return retry
|
|
|
|
|
|
def expand_config_vars(config):
|
|
"""
|
|
@brief Expands the shell variable for the repo string from `config`
|
|
"""
|
|
|
|
config["git"]["repo"] = os.path.expandvars(config["git"]["repo"])
|