snapshot of https://github.com/ActivityWatch/aw-core.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Build / Test on ubuntu-latest, py-3.8 (push) Successful in 4m21s
Lint / lint (push) Successful in 25s
Build / Test on macOS-latest, py-3.8 (push) Has been cancelled
Build / Test on windows-latest, py-3.8 (push) Has been cancelled
CodeQL / Analyze (python) (push) Failing after 1s
Some checks failed
Build / Test on ubuntu-latest, py-3.8 (push) Successful in 4m21s
Lint / lint (push) Successful in 25s
Build / Test on macOS-latest, py-3.8 (push) Has been cancelled
Build / Test on windows-latest, py-3.8 (push) Has been cancelled
CodeQL / Analyze (python) (push) Failing after 1s
This commit is contained in:
24
aw_core/util.py
Normal file
24
aw_core/util.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import sys
|
||||
from typing import Tuple
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class VersionException(Exception): ...
|
||||
|
||||
|
||||
def _version_info_tuple() -> Tuple[int, int, int]: # pragma: no cover
|
||||
return (sys.version_info.major, sys.version_info.minor, sys.version_info.micro)
|
||||
|
||||
|
||||
def assert_version(required_version: Tuple[int, ...] = (3, 5)): # pragma: no cover
|
||||
actual_version = _version_info_tuple()
|
||||
if actual_version <= required_version:
|
||||
raise VersionException(
|
||||
(
|
||||
"Python version {} not supported, you need to upgrade your Python"
|
||||
+ " version to at least {}."
|
||||
).format(required_version)
|
||||
)
|
||||
logger.debug(f"Python version: {_version_info_tuple()}")
|
||||
Reference in New Issue
Block a user