From dc0a4ca234c7f6365d2c97f4b2dc0d2f75c9238d Mon Sep 17 00:00:00 2001 From: Aren Elchinyan Date: Sun, 22 Oct 2023 15:32:53 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B0=20platform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pbuild.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pbuild.py b/pbuild.py index 89a9c63..a86e78c 100644 --- a/pbuild.py +++ b/pbuild.py @@ -2,7 +2,6 @@ import os import shutil import subprocess import time -import platform from multiprocessing import Pool @@ -96,13 +95,19 @@ def check_limine(): def check_os(): - current_os = platform.system().lower() - - if current_os == 'linux': - dist = platform.linux_distribution()[0].lower() - - if dist == 'ubuntu' or dist == 'debian': - return 1 + import platform + using_distro = False + try: + import distro + using_distro = True + except ImportError: + pass + if using_distro: + linux_distro = distro.like() + else: + linux_distro = platform.linux_distribution()[0] + if linux_distro.lower( in ['debian', 'ubuntu']: + return 1 return 0 def check_tools():