1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Removed tuple-version use

This commit is contained in:
krateng 2021-12-26 21:36:36 +01:00
parent af569ae983
commit 83f1956256
6 changed files with 11 additions and 15 deletions

View File

@ -6,14 +6,14 @@ try:
import toml
with open("./pyproject.toml") as filed:
metadata = toml.load(filed)['project']
VERSIONSTR = metadata['version']
VERSION = metadata['version']
HOMEPAGE = metadata['urls']['homepage']
except:
# package distributrion
from pkg_resources import get_distribution
pkg = get_distribution('maloja') # also contains a metadata
VERSIONSTR = pkg.version
VERSION = pkg.version
#urls = metadata.metadata('maloja').get_all('Project-URL')
#urls = [e.split(', ') for e in urls]
@ -22,7 +22,4 @@ except:
HOMEPAGE = "https://github.com/krateng/maloja"
VERSION = VERSIONSTR.split('.')
USER_AGENT = f"Maloja/{VERSIONSTR} ( {HOMEPAGE} )"
USER_AGENT = f"Maloja/{VERSION} ( {HOMEPAGE} )"

View File

@ -1,6 +1,6 @@
from ..database import *
from ..globalconf import malojaconfig, apikeystore
from ..__pkginfo__ import VERSION, VERSIONSTR
from ..__pkginfo__ import VERSION
from ..malojauri import uri_to_internal
from .. import utilities
@ -43,7 +43,6 @@ def server_info():
return {
"name":malojaconfig["NAME"],
"version":VERSION,
"versionstring":VERSIONSTR,
"db_status":dbstatus
}

View File

@ -3,7 +3,7 @@ from doreah.configuration import Configuration
from doreah.configuration import types as tp
from doreah.keystore import KeyStore
from .__pkginfo__ import VERSIONSTR
from .__pkginfo__ import VERSION
@ -275,7 +275,7 @@ data_dir = {
### write down the last ran version
with open(pthj(dir_settings['state'],".lastmalojaversion"),"w") as filed:
filed.write(VERSIONSTR)
filed.write(VERSION)
filed.write("\n")

View File

@ -15,7 +15,7 @@ from .. import globalconf
def print_header_info():
print()
print("#####")
print("Maloja v" + info.VERSIONSTR)
print("Maloja v" + info.VERSION)
print(info.HOMEPAGE)
print("#####")
print()
@ -120,7 +120,7 @@ def main(*args,**kwargs):
}
if "version" in kwargs:
print(info.VERSIONSTR)
print(info.VERSION)
else:
try:
action, *args = args

View File

@ -1,4 +1,4 @@
from ..__pkginfo__ import VERSIONSTR
from ..__pkginfo__ import VERSION
from ..malojatime import ranges, thisweek, thisyear
from ..globalconf import malojaconfig
@ -100,7 +100,7 @@ def send_stats():
"data":json.dumps({
"name":malojaconfig["NAME"],
"url":malojaconfig["PUBLIC_URL"],
"version":VERSIONSTR,
"version":VERSION,
"artists":len(ARTISTS),
"tracks":len(TRACKS),
"scrobbles":len(SCROBBLES)

View File

@ -22,7 +22,7 @@
neo.xhttprequest("/apis/mlj_1/serverinfo",{},"GET",json=true).then((response)=>{
result = JSON.parse(response.responseText);
thisvers = result.version;
thisvers = result.version.split(".");
document.getElementById("latestversion").innerHTML = latestvers.join(".");
document.getElementById("currentversion").innerHTML = thisvers.join(".");