def read_os_release()

in dcrpm/util.py [0:0]


def read_os_release():
    # type: () -> t.Dict[str, str]
    """
    Read /etc/os-release (if it exists) and parse the key/value data into
    a dict.
    """
    data = {}
    if os.path.exists("/etc/os-release"):
        with open("/etc/os-release", "r") as f:
            for line in f:
                if line.strip() == "":
                    continue
                (key, value) = line.split("=", 2)
                data[key.strip()] = value.strip()

    return data