1
"""Get information from /etc/lsb_release."""
3
LSB_RELEASE_FILENAME = "/etc/lsb-release"
4
LSB_RELEASE_INFO_KEYS = {"DISTRIB_ID": "distributor-id",
5
"DISTRIB_DESCRIPTION": "description",
6
"DISTRIB_RELEASE": "release",
7
"DISTRIB_CODENAME": "code-name"}
10
def parse_lsb_release(lsb_release_filename):
11
"""Return a C{dict} holding information about the system LSB release.
13
@raises: An IOError exception if C{lsb_release_filename} could not be read.
15
fd = open(lsb_release_filename, "r")
19
key, value = line.split("=")
20
if key in LSB_RELEASE_INFO_KEYS:
21
key = LSB_RELEASE_INFO_KEYS[key.strip()]
22
value = value.strip().strip('"')