feat(playout): use liquidsoap version functions
- remove "packaging" package
This commit is contained in:
parent
58ad40f997
commit
2bc7d64cc4
9 changed files with 83 additions and 54 deletions
26
playout/libretime_playout/liquidsoap/version.py
Normal file
26
playout/libretime_playout/liquidsoap/version.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
import re
|
||||
from subprocess import PIPE, run
|
||||
from typing import Tuple
|
||||
|
||||
LIQUIDSOAP_VERSION_RE = re.compile(r"(?:Liquidsoap )?(\d+).(\d+).(\d+)")
|
||||
LIQUIDSOAP_MIN_VERSION = (1, 1, 1)
|
||||
|
||||
|
||||
def parse_liquidsoap_version(version: str) -> Tuple[int, int, int]:
|
||||
match = LIQUIDSOAP_VERSION_RE.search(version)
|
||||
|
||||
if match is None:
|
||||
return (0, 0, 0)
|
||||
return (int(match.group(1)), int(match.group(2)), int(match.group(3)))
|
||||
|
||||
|
||||
def get_liquidsoap_version() -> Tuple[int, int, int]:
|
||||
cmd = run(
|
||||
("liquidsoap", "--check", "print(liquidsoap.version) shutdown()"),
|
||||
check=True,
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
universal_newlines=True,
|
||||
)
|
||||
|
||||
return parse_liquidsoap_version(cmd.stdout)
|
Loading…
Add table
Add a link
Reference in a new issue