1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #20487 from mguetschow/dhcpv6-os

dist/tools/dhcpv6-pd_ia: recognize Debian correctly
This commit is contained in:
Marian Buschsieweke 2024-03-19 22:54:21 +00:00 committed by GitHub
commit 0c2601df7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,9 +27,7 @@ __email__ = "m.lenders@fu-berlin.de"
class PackageManagerFactory(object):
@staticmethod
def _get_linux_distro():
if hasattr(platform, "linux_distribution"):
return platform.linux_distribution()[0]
elif os.path.exists("/etc/os-release"):
if os.path.exists("/etc/os-release"):
with open("/etc/os-release") as f:
for line in f:
m = re.match(r"^NAME=\"(.+)\"$", line)
@ -42,7 +40,7 @@ class PackageManagerFactory(object):
system = platform.system()
if system == "Linux":
system = cls._get_linux_distro()
if system in ["Debian", "Ubuntu", "Linux Mint"]:
if system.startswith(("Debian", "Ubuntu", "Linux Mint")):
return Apt("Debian")
if system in ["Arch Linux"]:
return PacMan("Arch")