1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Properly set royalnet's version

This commit is contained in:
Steffo 2020-07-31 16:44:17 +02:00
parent f4c0e306f5
commit 703c510d3c
7 changed files with 12 additions and 11 deletions

3
royalnet/__init__.py Normal file
View file

@ -0,0 +1,3 @@
import pkg_resources
__version__ = pkg_resources.get_distribution(__name__).version

View file

@ -1,4 +1,4 @@
import royalnet.version
import royalnet
from royalnet.commands import *
@ -12,7 +12,7 @@ class RoyalnetversionCommand(Command):
if __debug__:
message = f" Royalnet [url=https://github.com/Steffo99/royalnet/]Unreleased[/url]\n"
else:
message = f" Royalnet [url=https://github.com/Steffo99/royalnet/releases/tag/{royalnet.version.semantic}]{royalnet.version.semantic}[/url]\n"
if "69" in royalnet.version.semantic:
message = f" Royalnet [url=https://github.com/Steffo99/royalnet/releases/tag/{royalnet.__version__}]{royalnet.__version__}[/url]\n"
if "69" in royalnet.__version__:
message += "(Nice.)"
await data.reply(message)

View file

@ -1,4 +1,4 @@
import royalnet.version as rv
import royalnet
import royalnet.constellation.api as rca
import royalnet.utils as ru
@ -12,5 +12,5 @@ class ApiRoyalnetVersionStar(rca.ApiStar):
async def get(self, data: rca.ApiData) -> ru.JSON:
"""Get the current Royalnet version."""
return {
"semantic": rv.semantic
"semantic": royalnet.__version__
}

View file

@ -4,7 +4,7 @@ from royalnet.constellation import PageStar
from royalnet.constellation.api import ApiStar
from starlette.requests import Request
from starlette.responses import Response, HTMLResponse
from royalnet.version import semantic
import royalnet
backtick = "\u0060"
@ -26,7 +26,7 @@ class DocsStar(PageStar):
"info": {
"description": "Autogenerated Royalnet API documentation",
"title": "Royalnet",
"version": f"{semantic}",
"version": f"{royalnet.__version__}",
},
"paths": paths,
"components": {

View file

@ -1,7 +1,6 @@
import toml
import importlib
import click
from .version import semantic
p = click.echo

View file

@ -2,7 +2,7 @@ import logging
import sys
import traceback
from typing import *
from royalnet.version import semantic
import royalnet
import functools
try:
@ -24,7 +24,7 @@ def init_sentry(sentry_cfg: Dict[str, Any]):
if sentry_sdk is None:
raise ImportError("`sentry` extra is not installed")
log.debug("Initializing Sentry...")
release = f"royalnet@{semantic}"
release = f"royalnet@{royalnet.__version__}"
sentry_sdk.init(sentry_cfg["dsn"],
integrations=[AioHttpIntegration(),
SqlalchemyIntegration(),

View file

@ -1 +0,0 @@
semantic = "5.10.4"