From 3521497002af47d9f673caabe4b191ca4e996cf9 Mon Sep 17 00:00:00 2001 From: Caohongtao Date: Wed, 3 Apr 2024 09:52:10 +0000 Subject: [PATCH] update bin/install_tone_deps.py. Optimized the way to obtain system information Signed-off-by: Caohongtao --- bin/install_tone_deps.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/install_tone_deps.py b/bin/install_tone_deps.py index d74e169..f6440ad 100755 --- a/bin/install_tone_deps.py +++ b/bin/install_tone_deps.py @@ -97,16 +97,14 @@ def has_apt(): def get_os_version(): distro = "" version_id = "" - with open("/etc/os-release") as os_release: - info = os_release.readlines() - for l in info: + with open("/etc/os-release",'r') as os_release: + for l in os_release: if l.startswith("ID="): distro = "".join(l.split("\"")).strip().split("=")[1] - break - for l in info: if l.startswith("VERSION_ID="): version_id = "".join(l.split("\"")).strip().split("=")[1] break + if distro not in base_pkg_mapping: print("Unsupported OS distro: %s" %distro) if has_yum(): -- Gitee