Skip to content
Snippets Groups Projects
Commit 513a517b authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

split system utils functions

parent 8f77e38c
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
"""System utils."""
from configparser import ConfigParser
SUPPORTED_PLATFORMS = (("debian", "10"), ("ubuntu", "18.04"))
def dist() -> tuple:
"""Return distribution name and version).
:return: Distribution name and version
:rtype: tuple
"""
parser = ConfigParser()
with open("/etc/os-release") as os_release:
parser.read_string("[os]\n{}".format(os_release.read()))
return (parser["os"]["ID"], parser["os"]["VERSION_ID"].strip('"'))
def supported_platform() -> bool:
"""Let you know if the current platform is supported.
:return: Wether the platform is supported or not
:rtype: bool
"""
return dist() in SUPPORTED_PLATFORMS
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment