craft_providers.util.os_release module

Parser for /etc/os-release.

craft_providers.util.os_release.parse_os_release(content)[source]

Parser for /etc/os-release.

Format documentation at:

https://www.freedesktop.org/software/systemd/man/os-release.html

Example os-release contents:

NAME="Ubuntu"
VERSION="20.10 (Groovy Gorilla)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.10"
VERSION_ID="20.10"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=groovy
UBUNTU_CODENAME=groovy
Parameters

content (str) – String contents of os-release file.

Return type

Dict[str, str]

Returns

Dictionary of key-mappings found in os-release. Values are stripped of encapsulating quotes.