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