Skip to content
Permalink
Browse files
build_release: Fail GitHub uploads early
  • Loading branch information
The-Compiler committed Jul 7, 2017
1 parent 6a8d2ac commit 5098aa3
Showing 1 changed file with 14 additions and 3 deletions.
@@ -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

0 comments on commit 5098aa3

Please sign in to comment.