1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +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 * from royalnet.commands import *
@ -12,7 +12,7 @@ class RoyalnetversionCommand(Command):
if __debug__: if __debug__:
message = f" Royalnet [url=https://github.com/Steffo99/royalnet/]Unreleased[/url]\n" message = f" Royalnet [url=https://github.com/Steffo99/royalnet/]Unreleased[/url]\n"
else: else:
message = f" Royalnet [url=https://github.com/Steffo99/royalnet/releases/tag/{royalnet.version.semantic}]{royalnet.version.semantic}[/url]\n" message = f" Royalnet [url=https://github.com/Steffo99/royalnet/releases/tag/{royalnet.__version__}]{royalnet.__version__}[/url]\n"
if "69" in royalnet.version.semantic: if "69" in royalnet.__version__:
message += "(Nice.)" message += "(Nice.)"
await data.reply(message) 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.constellation.api as rca
import royalnet.utils as ru import royalnet.utils as ru
@ -12,5 +12,5 @@ class ApiRoyalnetVersionStar(rca.ApiStar):
async def get(self, data: rca.ApiData) -> ru.JSON: async def get(self, data: rca.ApiData) -> ru.JSON:
"""Get the current Royalnet version.""" """Get the current Royalnet version."""
return { 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 royalnet.constellation.api import ApiStar
from starlette.requests import Request from starlette.requests import Request
from starlette.responses import Response, HTMLResponse from starlette.responses import Response, HTMLResponse
from royalnet.version import semantic import royalnet
backtick = "\u0060" backtick = "\u0060"
@ -26,7 +26,7 @@ class DocsStar(PageStar):
"info": { "info": {
"description": "Autogenerated Royalnet API documentation", "description": "Autogenerated Royalnet API documentation",
"title": "Royalnet", "title": "Royalnet",
"version": f"{semantic}", "version": f"{royalnet.__version__}",
}, },
"paths": paths, "paths": paths,
"components": { "components": {

View file

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

View file

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

View file

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