updatecheck: support XDG-based token location
Have updatecheck look in $XDG_DATA_HOME/zcash/updatecheck/token for the GH token. Having one in the repo will still take precedence (for pre-existing users, as well as if you want to override the token used in a particular case). The new location is standardized, exists at the user level (as the token logically does), and means that you don't need to copy files around if you get a new clone or worktree to do a release.
This commit is contained in:
parent
4c21d6f444
commit
8e333b3f49
|
@ -28,9 +28,9 @@ Check that dependencies are up-to-date or have been postponed:
|
|||
$ ./qa/zcash/updatecheck.py
|
||||
```
|
||||
|
||||
You can optionally create an `.updatecheck-token` file in the root of the
|
||||
repository to avoid running into GitHub rate limiting. Create an unprivileged
|
||||
personal access token on GitHub and copy the value into the file.
|
||||
You can optionally create an `$XDG_DATA_HOME/zcash/updatecheck/token` file to
|
||||
avoid running into GitHub rate limiting. Create an unprivileged personal access
|
||||
token on GitHub and copy the value into the file.
|
||||
|
||||
If there are updates that have not been postponed, review their changelogs
|
||||
for urgent security fixes, and if there aren't any, postpone the update by
|
||||
|
@ -58,9 +58,8 @@ The release script has the following dependencies:
|
|||
|
||||
- `help2man`
|
||||
- `debchange` (part of the devscripts Debian package)
|
||||
|
||||
You can optionally install the `progressbar2` Python module with pip to have a
|
||||
progress bar displayed during the build process.
|
||||
- the python modules `progressbar2` (optional - displays a progress bar),
|
||||
`requests` and `xdg`
|
||||
|
||||
## Versioning
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import requests
|
|||
import os
|
||||
import re
|
||||
import sys
|
||||
import xdg
|
||||
import datetime
|
||||
|
||||
SOURCE_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..")
|
||||
|
@ -113,6 +114,8 @@ def get_dependency_list():
|
|||
|
||||
def parse_token():
|
||||
token_path = os.path.realpath(os.path.join(SOURCE_ROOT, ".updatecheck-token"))
|
||||
if not os.path.exists(token_path):
|
||||
token_path = os.path.join(xdg.xdg_data_home(), "zcash/updatecheck/token")
|
||||
try:
|
||||
with open(token_path, encoding='utf8') as f:
|
||||
token = f.read().strip()
|
||||
|
|
Loading…
Reference in New Issue