refactor: parsed to flags, more path

This commit is contained in:
Дмитрий Абдрахманов 2024-10-09 17:13:41 +03:00
parent f1d6e154f9
commit 651dbdc5be
2 changed files with 7 additions and 7 deletions

View File

@ -10,19 +10,19 @@ def install(parsed) -> None:
args = parsed.parse_args() args = parsed.parse_args()
if args.install: if args.install:
projectDir = Path(__file__).resolve().parent.parent projectDir = Path(__file__).resolve().parent.parent
homeDir = os.getenv("HOME") homeDir = Path(os.getenv("HOME"))
serviceDirExist = os.path.isdir(homeDir + "/.config/systemd/user/") serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/"))
delivered = False delivered = False
if serviceDirExist: if serviceDirExist:
delivered = filecmp.cmp( delivered = filecmp.cmp(
os.path.join(projectDir, "services/wthrc.service"), os.path.join(projectDir, "services/wthrc.service"),
homeDir + "/.config/systemd/user/wthrc.service", os.path.join(homeDir, ".config/systemd/user/wthrc.service"),
shallow=True, shallow=True,
) )
if not delivered or not serviceDirExist: if not delivered or not serviceDirExist:
os.environ["DIR"] = projectDir os.environ["DIR"] = str(projectDir)
subprocess.call(["sh", os.path.join(projectDir, "scripts/install.sh")]) subprocess.call(["sh", os.path.join(projectDir, "scripts/install.sh")])
subprocess.call(["sh", os.path.join(projectDir, "scripts/runner.sh")]) subprocess.call(["sh", os.path.join(projectDir, "scripts/runner.sh")])

View File

@ -1,7 +1,7 @@
from installer import install from installer import install
import argparse import argparse
parsed = argparse.ArgumentParser() flags = argparse.ArgumentParser()
parsed.add_argument("--install", "-i", action="store_true") flags.add_argument("--install", "-i", action="store_true")
install(parsed) install(flags)