Commit 2386e68d authored by Blaise Thompson's avatar Blaise Thompson Committed by Kyle Sunden
Browse files

add daemon-level version

parent 64910b66
......@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
- added changelog
- Use format strings instead of assuming concatenation
- added mypy to precommit
- added daemon-level version, see [YEP-105](https://yeps.yaq.fyi/105/)
### Changed
- from now on, yaqd-gdrive will use calendar based versioning
......
from .__version__ import *
from ._gdrive import *
"""Define version."""
import pathlib
here = pathlib.Path(__file__).resolve().parent
__all__ = ["__version__", "__branch__"]
# read from VERSION file
with open(str(here / "VERSION")) as f:
__version__ = f.read().strip()
# add git branch, if appropriate
p = here.parent / ".git"
if p.is_file():
with open(str(p)) as f:
p = p.parent / f.readline()[8:].strip() # Strip "gitdir: "
p = p / "HEAD"
if p.exists():
with open(str(p)) as f:
__branch__ = f.readline().rstrip().split(r"/")[-1]
__version__ += "+" + __branch__
else:
__branch__ = ""
......@@ -14,6 +14,8 @@ import aiohttp.web # type: ignore
import appdirs # type: ignore
import yaqd_core
from .__version__ import __branch__
UploadItem = collections.namedtuple(
"UploadItem", "kind name path parent client_id", defaults=[None]
......@@ -39,6 +41,7 @@ def refresh_oauth(func):
class GDrive(yaqd_core.Base):
_kind = "gdrive"
_version = "1.0.0" + f"+{__branch__}" if __branch__ else ""
defaults = {
"scopes": ["https://www.googleapis.com/auth/drive.file"],
"authorization_url": "https://accounts.google.com/o/oauth2/v2/auth",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment