1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

support python 3.6

This commit is contained in:
checktheroads
2020-02-16 00:52:51 -07:00
parent b219a2cb1a
commit 2b9605d7dc
3 changed files with 10 additions and 5 deletions

View File

@@ -214,4 +214,6 @@ def start():
"""Start the web server with Uvicorn ASGI."""
import uvicorn
# TODO: figure out workers issue
# uvicorn.run("hyperglass.api:app", **ASGI_PARAMS) # noqa: E800
uvicorn.run(app, **ASGI_PARAMS)

View File

@@ -10,6 +10,7 @@ from hyperglass.util import (
build_frontend,
clear_redis_cache,
)
from hyperglass.constants import MIN_PYTHON_VERSION
from hyperglass.exceptions import HyperglassError
from hyperglass.configuration import (
URL_DEV,
@@ -29,9 +30,10 @@ async def check_python_version():
"""
try:
python_version = check_python()
log.info(f"Python {python_version} detected")
except RuntimeError as r:
raise HyperglassError(str(r), level="danger") from None
required = ".".join(tuple(str(v) for v in MIN_PYTHON_VERSION))
log.info(f"Python {python_version} detected ({required} required)")
except RuntimeError as e:
raise HyperglassError(str(e), level="danger") from None
async def check_redis_instance():

View File

@@ -69,12 +69,13 @@ def check_python():
{str} -- Python version
"""
import sys
import platform
from hyperglass.constants import MIN_PYTHON_VERSION
pretty_version = ".".join(tuple(str(v) for v in MIN_PYTHON_VERSION))
if sys.version_info < MIN_PYTHON_VERSION:
raise RuntimeError(f"Python {pretty_version}+ is required.")
return pretty_version
return platform.python_version()
async def build_ui(app_path):
@@ -460,7 +461,7 @@ async def build_frontend( # noqa: C901
elif dev_mode and not force:
log.debug("Running in developer mode, did not build new UI files")
migrate_static_assets()
migrate_static_assets(app_path)
except Exception as e:
raise RuntimeError(str(e))