Update dependencies installation process

pull/1/head
hikariatama 2023-03-13 08:34:43 +00:00
parent 91320ba487
commit 1cb7db9503
2 changed files with 21 additions and 55 deletions

View File

@ -29,75 +29,7 @@ if (
sys.exit(1)
if sys.version_info < (3, 8, 0):
print("🚫 Error: you must use at least Python version 3.8.0")
elif __package__ != "hikka": # In case they did python __main__.py
print("🚫 Error: you cannot run this as a script; you must execute as a package")
else:
try:
import hikkatl
except Exception:
pass
else:
try:
import hikkatl # noqa: F811
if tuple(map(int, hikkatl.__version__.split("."))) < (2, 0, 2):
raise ImportError
except ImportError:
print("🔄 Installing Hikka-TL...")
subprocess.run(
[
sys.executable,
"-m",
"pip",
"install",
"--force-reinstall",
"-q",
"--disable-pip-version-check",
"--no-warn-script-location",
"hikka-tl-new",
],
check=True,
)
restart()
try:
import hikkapyro
if tuple(map(int, hikkapyro.__version__.split("."))) < (2, 0, 102):
raise ImportError
except ImportError:
print("🔄 Installing Hikka-Pyro...")
subprocess.run(
[
sys.executable,
"-m",
"pip",
"install",
"--force-reinstall",
"-q",
"--disable-pip-version-check",
"--no-warn-script-location",
"hikka-pyro-new",
],
check=True,
)
restart()
try:
from . import log
log.init()
from . import main
except ImportError as e:
print(f"{str(e)}\n🔄 Attempting dependencies installation... Just wait ⏱")
def deps():
subprocess.run(
[
sys.executable,
@ -114,6 +46,41 @@ else:
check=True,
)
if sys.version_info < (3, 8, 0):
print("🚫 Error: you must use at least Python version 3.8.0")
elif __package__ != "hikka": # In case they did python __main__.py
print("🚫 Error: you cannot run this as a script; you must execute as a package")
else:
try:
import hikkatl
except Exception:
pass
else:
try:
import hikkatl # noqa: F811
if tuple(map(int, hikkatl.__version__.split("."))) < (2, 0, 2):
raise ImportError
import hikkapyro
if tuple(map(int, hikkapyro.__version__.split("."))) < (2, 0, 102):
raise ImportError
except ImportError:
print("🔄 Installing dependencies...")
deps()
restart()
try:
from . import log
log.init()
from . import main
except ImportError as e:
print(f"{str(e)}\n🔄 Attempting dependencies installation... Just wait ⏱")
deps()
restart()
if "HIKKA_DO_NOT_RESTART" in os.environ:

View File

@ -137,7 +137,6 @@ def generate_app_name() -> str:
:return: Random app name
:example: "Cresco Cibus Consilium"
"""
random.seed(0)
return " ".join(random.choices(LATIN_MOCK, k=3))