summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2017-07-07 14:28:36 +0200
committerFlorian Bruhin <git@the-compiler.org>2017-07-07 14:28:44 +0200
commit47ad8f212eedc1b2adf76da56ba1d7f4142449b8 (patch)
tree3f2d7a74cdb25fac8f65fe4fcbbf9e381a3e9a4b
parent7ac27fdd85507b59026b976f8bb6050ee30bd917 (diff)
downloadqutebrowser-47ad8f212eedc1b2adf76da56ba1d7f4142449b8.tar.gz
qutebrowser-47ad8f212eedc1b2adf76da56ba1d7f4142449b8.zip
build_release: Fail GitHub uploads early
-rwxr-xr-xscripts/dev/build_release.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py
index e6a4f89e1..6a6adb5bd 100755
--- a/scripts/dev/build_release.py
+++ b/scripts/dev/build_release.py
@@ -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