Added method to get the LIKE var contents as a list

This commit is contained in:
Joona Hoikkala 2016-07-30 10:39:35 +03:00
parent 7ab09f5ddf
commit 95fad04fdd
No known key found for this signature in database
GPG key ID: C14AAE0F5ADCB854

View file

@ -268,6 +268,19 @@ def get_systemd_os_info(filepath="/etc/os-release"):
return (os_name, os_version)
def get_systemd_os_like(filepath="/etc/os-release"):
"""
Get a list of strings that indicate the distribution likeness to
other distributions.
:param str filepath: File path of os-release file
:returns: List of distribution acronyms
:rtype: `list` of `str`
"""
return _get_systemd_os_release_var("LIKE", filepath).split(" ")
def _get_systemd_os_release_var(varname, filepath="/etc/os-release"):
"""
Get single value from systemd /etc/os-release