mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Tidy import naming
This will allow for previous variable naming
This commit is contained in:
parent
e01a0d5f65
commit
99ae7e01a1
@ -20,7 +20,7 @@ import itertools
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from socket import gethostname
|
from socket import gethostname
|
||||||
from contextlib import redirect_stderr, suppress
|
from contextlib import redirect_stderr, suppress
|
||||||
from packaging import version
|
from packaging import version as pkg_version
|
||||||
|
|
||||||
from app.classes.shared.null_writer import NullWriter
|
from app.classes.shared.null_writer import NullWriter
|
||||||
from app.classes.shared.console import Console
|
from app.classes.shared.console import Console
|
||||||
@ -94,10 +94,10 @@ class Helpers:
|
|||||||
"https://gitlab.com/api/v4/projects/20430749/repository/tags"
|
"https://gitlab.com/api/v4/projects/20430749/repository/tags"
|
||||||
)
|
)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
remote_version = version.parse(json.loads(response.text)[0]["name"])
|
remote_version = pkg_version.parse(json.loads(response.text)[0]["name"])
|
||||||
|
|
||||||
# Get local version data from the file and parse the semver
|
# Get local version data from the file and parse the semver
|
||||||
local_version = version.parse(self.get_version_string())
|
local_version = pkg_version.parse(self.get_version_string())
|
||||||
|
|
||||||
if remote_version > local_version:
|
if remote_version > local_version:
|
||||||
return remote_version
|
return remote_version
|
||||||
@ -124,14 +124,14 @@ class Helpers:
|
|||||||
winreg.HKEY_LOCAL_MACHINE, jdk_key_path
|
winreg.HKEY_LOCAL_MACHINE, jdk_key_path
|
||||||
) as kjdk:
|
) as kjdk:
|
||||||
for i in itertools.count():
|
for i in itertools.count():
|
||||||
ver = winreg.EnumKey(kjdk, i)
|
version = winreg.EnumKey(kjdk, i)
|
||||||
kjdk_current = winreg.OpenKey(
|
kjdk_current = winreg.OpenKey(
|
||||||
winreg.HKEY_LOCAL_MACHINE,
|
winreg.HKEY_LOCAL_MACHINE,
|
||||||
jdk_key_path,
|
jdk_key_path,
|
||||||
)
|
)
|
||||||
kjdk_current = winreg.OpenKey(
|
kjdk_current = winreg.OpenKey(
|
||||||
winreg.HKEY_LOCAL_MACHINE,
|
winreg.HKEY_LOCAL_MACHINE,
|
||||||
jdk_key_path + "\\" + ver,
|
jdk_key_path + "\\" + version,
|
||||||
)
|
)
|
||||||
kjdk_current_values = dict( # pylint: disable=consider-using-dict-comprehension
|
kjdk_current_values = dict( # pylint: disable=consider-using-dict-comprehension
|
||||||
[
|
[
|
||||||
@ -411,8 +411,8 @@ class Helpers:
|
|||||||
meta = version_data.get("meta", "?")
|
meta = version_data.get("meta", "?")
|
||||||
|
|
||||||
# set some defaults if we don't get version_data from our helper
|
# set some defaults if we don't get version_data from our helper
|
||||||
semver = f"{major}.{minor}.{sub}-{meta}"
|
version = f"{major}.{minor}.{sub}-{meta}"
|
||||||
return str(semver)
|
return str(version)
|
||||||
|
|
||||||
def encode_pass(self, password):
|
def encode_pass(self, password):
|
||||||
return self.passhasher.hash(password)
|
return self.passhasher.hash(password)
|
||||||
|
8
main.py
8
main.py
@ -7,7 +7,7 @@ import argparse
|
|||||||
import logging.config
|
import logging.config
|
||||||
import signal
|
import signal
|
||||||
import peewee
|
import peewee
|
||||||
from packaging import version
|
from packaging import version as pkg_version
|
||||||
|
|
||||||
from app.classes.shared.file_helpers import FileHelpers
|
from app.classes.shared.file_helpers import FileHelpers
|
||||||
from app.classes.shared.import3 import Import3
|
from app.classes.shared.import3 import Import3
|
||||||
@ -40,11 +40,11 @@ except ModuleNotFoundError as err:
|
|||||||
def do_intro():
|
def do_intro():
|
||||||
logger.info("***** Crafty Controller Started *****")
|
logger.info("***** Crafty Controller Started *****")
|
||||||
|
|
||||||
ver = helper.get_version_string()
|
version = helper.get_version_string()
|
||||||
|
|
||||||
intro = f"""
|
intro = f"""
|
||||||
{'/' * 75}
|
{'/' * 75}
|
||||||
#{("Welcome to Crafty Controller - v." + ver).center(73, " ")}#
|
#{("Welcome to Crafty Controller - v." + version).center(73, " ")}#
|
||||||
{'/' * 75}
|
{'/' * 75}
|
||||||
#{"Server Manager / Web Portal for your Minecraft server".center(73, " ")}#
|
#{"Server Manager / Web Portal for your Minecraft server".center(73, " ")}#
|
||||||
#{"Homepage: www.craftycontrol.com".center(73, " ")}#
|
#{"Homepage: www.craftycontrol.com".center(73, " ")}#
|
||||||
@ -234,7 +234,7 @@ if __name__ == "__main__":
|
|||||||
A new version of Crafty is available!
|
A new version of Crafty is available!
|
||||||
{'/' * 37}
|
{'/' * 37}
|
||||||
New version available: {remote_ver}
|
New version available: {remote_ver}
|
||||||
Current version: {version.parse(helper.get_version_string())}
|
Current version: {pkg_version.parse(helper.get_version_string())}
|
||||||
{'/' * 37}
|
{'/' * 37}
|
||||||
"""
|
"""
|
||||||
Console.yellow(notice)
|
Console.yellow(notice)
|
||||||
|
Loading…
Reference in New Issue
Block a user