build_release: Fail GitHub uploads early
This commit is contained in:
parent
6a8d2ac826
commit
5098aa388b
@ -292,6 +292,13 @@ def build_sdist():
|
||||
return artifacts
|
||||
|
||||
|
||||
def read_github_token():
|
||||
"""Read the GitHub API token from disk."""
|
||||
token_file = os.path.join(os.path.expanduser('~'), '.gh_token')
|
||||
with open(token_file, encoding='ascii') as f:
|
||||
token = f.read().strip()
|
||||
|
||||
|
||||
def github_upload(artifacts, tag):
|
||||
"""Upload the given artifacts to GitHub.
|
||||
|
||||
@ -302,9 +309,7 @@ def github_upload(artifacts, tag):
|
||||
import github3
|
||||
utils.print_title("Uploading to github...")
|
||||
|
||||
token_file = os.path.join(os.path.expanduser('~'), '.gh_token')
|
||||
with open(token_file, encoding='ascii') as f:
|
||||
token = f.read().strip()
|
||||
token = read_github_token()
|
||||
gh = github3.login(token=token)
|
||||
repo = gh.repository('qutebrowser', 'qutebrowser')
|
||||
|
||||
@ -341,6 +346,12 @@ def main():
|
||||
|
||||
upload_to_pypi = False
|
||||
|
||||
if args.upload is not None:
|
||||
# Fail early when trying to upload without github3 installed
|
||||
# or without API token
|
||||
import github3
|
||||
read_github_token()
|
||||
|
||||
if os.name == 'nt':
|
||||
if sys.maxsize > 2**32:
|
||||
# WORKAROUND
|
||||
|
Loading…
Reference in New Issue
Block a user