version.distribution(): Handle Funtoo
This commit is contained in:
parent
5f4ecd7efc
commit
3a2d64ba46
@ -81,6 +81,8 @@ def distribution():
|
||||
return None
|
||||
|
||||
pretty = info.get('PRETTY_NAME', 'Unknown')
|
||||
if pretty == 'Linux': # Thanks, Funtoo
|
||||
pretty = info.get('NAME', pretty)
|
||||
|
||||
if 'VERSION_ID' in info:
|
||||
dist_version = pkg_resources.parse_version(info['VERSION_ID'])
|
||||
@ -88,8 +90,11 @@ def distribution():
|
||||
dist_version = None
|
||||
|
||||
dist_id = info.get('ID', None)
|
||||
id_mappings = {
|
||||
'funtoo': 'gentoo', # does not have ID_LIKE=gentoo
|
||||
}
|
||||
try:
|
||||
parsed = Distribution[dist_id]
|
||||
parsed = Distribution[id_mappings.get(dist_id, dist_id)]
|
||||
except KeyError:
|
||||
parsed = Distribution.unknown
|
||||
|
||||
|
@ -164,6 +164,15 @@ from qutebrowser.browser import pdfjs
|
||||
version.DistributionInfo(
|
||||
id='manjaro', parsed=version.Distribution.manjaro,
|
||||
version=None, pretty='Manjaro Linux')),
|
||||
# Funtoo
|
||||
("""
|
||||
ID="funtoo"
|
||||
NAME="Funtoo GNU/Linux"
|
||||
PRETTY_NAME="Linux"
|
||||
""",
|
||||
version.DistributionInfo(
|
||||
id='funtoo', parsed=version.Distribution.gentoo,
|
||||
version=None, pretty='Funtoo GNU/Linux')),
|
||||
])
|
||||
def test_distribution(tmpdir, monkeypatch, os_release, expected):
|
||||
os_release_file = tmpdir / 'os-release'
|
||||
|
Loading…
Reference in New Issue
Block a user