0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2024-12-23 22:22:59 +03:00

Refactor code to improve readability

This commit is contained in:
Ben Puls 2024-08-29 18:55:40 +05:00
parent 6ab3b696ed
commit f6f00319ed

View File

@ -3,12 +3,14 @@ import os
import shutil import shutil
import subprocess import subprocess
def check_dependency(dependency): def check_dependency(dependency):
if shutil.which(dependency): if shutil.which(dependency):
return True return True
print(f"{dependency} not installed.") print(f"{dependency} not installed.")
return False return False
script_dir = os.path.dirname(os.path.realpath(__file__)) script_dir = os.path.dirname(os.path.realpath(__file__))
# loading versions information from json # loading versions information from json
@ -16,6 +18,7 @@ version_info_path = os.path.join(script_dir, "version_info.json")
with open(version_info_path, "r") as f: with open(version_info_path, "r") as f:
version_info = json.load(f) version_info = json.load(f)
# Arch # Arch
def generate_arch(): def generate_arch():
pkgbuild_template = os.path.join(script_dir, "../templates/PKGBUILD") pkgbuild_template = os.path.join(script_dir, "../templates/PKGBUILD")
@ -44,6 +47,7 @@ def is_nix_version_2_19():
return True return True
return False return False
def generate_nix(): def generate_nix():
nixcmd = "nix --extra-experimental-features nix-command --extra-experimental-features flakes" nixcmd = "nix --extra-experimental-features nix-command --extra-experimental-features flakes"
flake_path = os.path.join(script_dir, "../flake.nix") flake_path = os.path.join(script_dir, "../flake.nix")