mach: remove ubuntu version warning (#38656)

Removes the unsupported ubuntu version warning from mach. Also removes
the related version values on the Linux object, as they're not used
anywhere else nor are they maintained.

Testing: Only removes a warning, no test necessary.
Fixes: #38505.

---------

Signed-off-by: lumiscosity <averyrudelphe@gmail.com>
This commit is contained in:
lumiscosity 2025-08-13 20:56:38 +02:00 committed by GitHub
parent f3f981030f
commit 97a114b248
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,7 @@ import distro
import os import os
import subprocess import subprocess
import shutil import shutil
from typing import Optional, Tuple from typing import Optional
from .base import Base from .base import Base
from .build_target import BuildTarget from .build_target import BuildTarget
@ -167,39 +167,7 @@ class Linux(Base):
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.is_linux = True self.is_linux = True
(self.distro, self.version) = Linux.get_distro_and_version() self.distro = distro.name()
@staticmethod
def get_distro_and_version() -> Tuple[str, str]:
distrib = distro.name()
version = distro.version()
if distrib in ["LinuxMint", "Linux Mint", "KDE neon", "Pop!_OS", "TUXEDO OS"]:
if "." in version:
major, _ = version.split(".", 1)
else:
major = version
distrib = "Ubuntu"
if major == "22":
version = "22.04"
elif major == "21":
version = "21.04"
elif major == "20":
version = "20.04"
elif major == "19":
version = "18.04"
elif major == "18":
version = "16.04"
if distrib.lower() == "elementary":
distrib = "Ubuntu"
if version == "5.0":
version = "18.04"
elif version[0:3] == "0.4":
version = "16.04"
return (distrib, version)
def _platform_bootstrap(self, force: bool) -> bool: def _platform_bootstrap(self, force: bool) -> bool:
if self.distro.lower() == "nixos": if self.distro.lower() == "nixos":
@ -211,10 +179,6 @@ class Linux(Base):
print(" $ nix-shell") print(" $ nix-shell")
return False return False
if self.distro.lower() == "ubuntu" and self.version > "22.04":
print(f"WARNING: unsupported version of {self.distro}: {self.version}")
# FIXME: Better version checking for these distributions.
if self.distro.lower() not in [ if self.distro.lower() not in [
"arch linux", "arch linux",
"arch", "arch",
@ -228,6 +192,12 @@ class Linux(Base):
"fedora", "fedora",
"nixos", "nixos",
"ubuntu", "ubuntu",
"linuxmint",
"linux mint",
"kde neon",
"pop!_os",
"tuxedo os",
"elementary",
"void", "void",
"fedora linux asahi remix", "fedora linux asahi remix",
]: ]: