From 2016cc4db1569b9d210de235ef9feaefad6a7689 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 12 Jan 2023 11:22:08 +0000 Subject: minor tweaks --- src/backend/checkenv.py | 20 +------------------- src/backend/getenv.py | 20 +++++++++++++++++++- src/backend/update.py | 4 ++-- src/backend/upgrade.py | 4 ++-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/backend/checkenv.py b/src/backend/checkenv.py index 948bbfe..49c2883 100644 --- a/src/backend/checkenv.py +++ b/src/backend/checkenv.py @@ -3,32 +3,14 @@ import os import subprocess import sisyphus.getenv -import sisyphus.getfs def root(): return True if os.getuid() == 0 else False -def branch(): - activeBranch = None - - if os.path.isdir(os.path.join(sisyphus.getfs.gentooRepoDir, '.git')): - os.chdir(sisyphus.getfs.gentooRepoDir) - localBranch = subprocess.check_output( - ['git', 'rev-parse', '--abbrev-ref', 'HEAD']) - - if localBranch.decode().strip() == 'master': - activeBranch = str('master') - - if localBranch.decode().strip() == 'next': - activeBranch = str('next') - - return activeBranch - - def sanity(): - activeBranch = branch() + activeBranch = sisyphus.getenv.systemBranch() binhostURL = sisyphus.getenv.binhostURL() isSane = int() diff --git a/src/backend/getenv.py b/src/backend/getenv.py index eebbfee..fcefa91 100644 --- a/src/backend/getenv.py +++ b/src/backend/getenv.py @@ -2,6 +2,7 @@ import io import subprocess +import sisyphus.getfs def binhostURL(): @@ -12,8 +13,8 @@ def binhostURL(): for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): if "PORTAGE_BINHOST" in portageOutput: binhostURL = portageOutput.rstrip().split("=")[1].strip('\"') - portageExec.wait() + return binhostURL @@ -34,3 +35,20 @@ def csvURL(): 'packages', 'csv') + 'remoteDescriptionsPre.csv' return packagesCsvURL, descriptionsCsvURL + + +def systemBranch(): + activeBranch = None + + if os.path.isdir(os.path.join(sisyphus.getfs.gentooRepoDir, '.git')): + os.chdir(sisyphus.getfs.gentooRepoDir) + localBranch = subprocess.check_output( + ['git', 'rev-parse', '--abbrev-ref', 'HEAD']) + + if localBranch.decode().strip() == 'master': + activeBranch = str('master') + + if localBranch.decode().strip() == 'next': + activeBranch = str('next') + + return activeBranch diff --git a/src/backend/update.py b/src/backend/update.py index 856ecd0..45d231e 100644 --- a/src/backend/update.py +++ b/src/backend/update.py @@ -21,7 +21,7 @@ def syncAll(): @animation.wait('fetching updates') def start(): - activeBranch = sisyphus.checkenv.branch() + activeBranch = sisyphus.getenv.systemBranch() binhostURL = sisyphus.getenv.binhostURL() isSane = sisyphus.checkenv.sanity() @@ -39,7 +39,7 @@ def start(): def xstart(): - activeBranch = sisyphus.checkenv.branch() + activeBranch = sisyphus.getenv.systemBranch() binhostURL = sisyphus.getenv.binhostURL() isSane = sisyphus.checkenv.sanity() diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py index 3c48955..0ec707c 100644 --- a/src/backend/upgrade.py +++ b/src/backend/upgrade.py @@ -50,7 +50,7 @@ def start(): continue else: print(sisyphus.getcolor.bright_red + - "\nNo package found!\n" + sisyphus.getcolor.reset) + "\nNo package upgrades found!\n" + sisyphus.getcolor.reset) sys.exit() else: print(sisyphus.getcolor.bright_red + @@ -105,7 +105,7 @@ def estart(): continue else: print(sisyphus.getcolor.bright_red + - "\nNo package found!\n" + sisyphus.getcolor.reset) + "\nNo package upgrades found!\n" + sisyphus.getcolor.reset) sys.exit() else: if not len(areBinaries) == 0: -- cgit v1.2.3