mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
bump min Python version to 3.7; check python version at start
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
# Standard Library Imports
|
||||
import sys
|
||||
|
||||
MIN_PYTHON_VERSION = (3, 7)
|
||||
|
||||
protocol_map = {80: "http", 8080: "http", 443: "https", 8443: "https"}
|
||||
|
||||
target_format_space = ("huawei", "huawei_vrpv8")
|
||||
|
@ -39,9 +39,17 @@ from hyperglass.exceptions import ResponseEmpty
|
||||
from hyperglass.exceptions import RestError
|
||||
from hyperglass.exceptions import ScrapeError
|
||||
from hyperglass.render import render_html
|
||||
from hyperglass.util import check_python
|
||||
from hyperglass.util import cpu_count
|
||||
from hyperglass.util import log
|
||||
|
||||
# Verify Python version meets minimum requirement
|
||||
try:
|
||||
python_version = check_python()
|
||||
log.info(f"Python {python_version} detected.")
|
||||
except RuntimeError as r:
|
||||
raise HyperglassError(str(r), alert="danger") from None
|
||||
|
||||
log.debug(f"Configuration Parameters: {params.dict(by_alias=True)}")
|
||||
|
||||
tempdir = tempfile.TemporaryDirectory(prefix="hyperglass_")
|
||||
|
@ -24,4 +24,22 @@ def cpu_count():
|
||||
return multiprocessing.cpu_count()
|
||||
|
||||
|
||||
def check_python():
|
||||
"""Verify Python Version.
|
||||
|
||||
Raises:
|
||||
RuntimeError: Raised if running Python version is invalid.
|
||||
|
||||
Returns:
|
||||
{str} -- Python version
|
||||
"""
|
||||
import sys
|
||||
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
|
||||
|
||||
|
||||
log = _logger()
|
||||
|
6
setup.py
6
setup.py
@ -2,8 +2,8 @@
|
||||
import sys
|
||||
from distutils.core import setup
|
||||
|
||||
if sys.version_info < (3, 6):
|
||||
sys.exit("Python 3.6+ is required.")
|
||||
if sys.version_info < (3, 7):
|
||||
sys.exit("Python 3.7+ is required.")
|
||||
|
||||
|
||||
with open("README.md", "r") as ld:
|
||||
@ -21,7 +21,7 @@ setup(
|
||||
author_email="matt@hyperglass.io",
|
||||
description=desc,
|
||||
url="https://github.com/checktheroads/hyperglass",
|
||||
python_requires=">=3.6",
|
||||
python_requires=">=3.7",
|
||||
packages=["hyperglass"],
|
||||
install_requires=requirements,
|
||||
license="BSD 3-Clause Clear License",
|
||||
|
Reference in New Issue
Block a user