From c7edab17a1b130b88010b26f1789da0569291676 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 26 Oct 2022 00:05:14 +0100 Subject: merge getCSV && getBinhost into getEnvironment --- src/backend/__init__.py | 1 - src/backend/checkEnvironment.py | 6 +++--- src/backend/getBinhost.py | 14 -------------- src/backend/installPkg.py | 10 +++++----- src/backend/installSrc.py | 8 ++++---- src/backend/updateAll.py | 18 +++++++++--------- src/backend/upgradePkg.py | 10 +++++----- src/backend/upgradeSrc.py | 4 ++-- 8 files changed, 28 insertions(+), 43 deletions(-) delete mode 100644 src/backend/getBinhost.py (limited to 'src/backend') diff --git a/src/backend/__init__.py b/src/backend/__init__.py index 26e1487..39c89ed 100644 --- a/src/backend/__init__.py +++ b/src/backend/__init__.py @@ -1,6 +1,5 @@ from .autoRemoveAll import * from .checkEnvironment import * -from .getBinhost import * from .getEnvironment import * from .getFilesystem import * from .installPkg import * diff --git a/src/backend/checkEnvironment.py b/src/backend/checkEnvironment.py index 200be15..9613fe6 100644 --- a/src/backend/checkEnvironment.py +++ b/src/backend/checkEnvironment.py @@ -2,7 +2,7 @@ import os import subprocess -import sisyphus.getBinhost +import sisyphus.getEnvironment import sisyphus.getFilesystem def root(): @@ -25,10 +25,10 @@ def branch(): def sanity(): activeBranch = branch() - isBinhost = sisyphus.getBinhost.start() + binhostURL = sisyphus.getEnvironment.binhostURL() isSane = int() - if "packages-next" in isBinhost: + if "packages-next" in binhostURL: if activeBranch == "next": isSane = int(1) else: diff --git a/src/backend/getBinhost.py b/src/backend/getBinhost.py deleted file mode 100644 index befa1f3..0000000 --- a/src/backend/getBinhost.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/python3 - -import subprocess - -def start(): - isBinhost = [] - portageExec = subprocess.Popen(['emerge', '--info', '--verbose'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = portageExec.communicate() - - for portageOutput in stdout.decode('ascii').splitlines(): - if "PORTAGE_BINHOST" in portageOutput: - isBinhost = portageOutput.rstrip().split("=")[1].strip('\"') - - return isBinhost diff --git a/src/backend/installPkg.py b/src/backend/installPkg.py index d827a3a..815eeb8 100644 --- a/src/backend/installPkg.py +++ b/src/backend/installPkg.py @@ -8,7 +8,7 @@ import subprocess import sys import wget import sisyphus.checkEnvironment -import sisyphus.getBinhost +import sisyphus.getEnvironment import sisyphus.getFilesystem import sisyphus.killPortage import sisyphus.resolveDeps @@ -19,7 +19,7 @@ def start(pkgname): if sisyphus.checkEnvironment.root(): sisyphus.updateAll.start() - isBinhost = sisyphus.getBinhost.start() + binhostURL = sisyphus.getEnvironment.binhostURL() areBinaries,areSources,needsConfig = sisyphus.resolveDeps.package(pkgname) if needsConfig == 0: @@ -30,7 +30,7 @@ def start(pkgname): if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary) - wget.download(isBinhost + binary) + wget.download(binhostURL + binary) print("\n") if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): @@ -63,14 +63,14 @@ def start(pkgname): sys.exit("\nYou need root permissions to do this, exiting!\n") def startqt(pkgname): - isBinhost = sisyphus.getBinhost.start() + binhostURL = sisyphus.getEnvironment.binhostURL() areBinaries,areSources,needsConfig = sisyphus.resolveDeps.package.__wrapped__(pkgname) #undecorate os.chdir(sisyphus.getFilesystem.portageCacheDir) print("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + " ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n") for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary) - wget.download(isBinhost + binary) + wget.download(binhostURL + binary) print("\n") if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): diff --git a/src/backend/installSrc.py b/src/backend/installSrc.py index 115091d..0768902 100644 --- a/src/backend/installSrc.py +++ b/src/backend/installSrc.py @@ -7,7 +7,7 @@ import subprocess import sys import wget import sisyphus.checkEnvironment -import sisyphus.getBinhost +import sisyphus.getEnvironment import sisyphus.getFilesystem import sisyphus.resolveDeps import sisyphus.syncDatabase @@ -17,7 +17,7 @@ def start(pkgname): if sisyphus.checkEnvironment.root(): sisyphus.updateAll.start() - isBinhost = sisyphus.getBinhost.start() + binhostURL = sisyphus.getEnvironment.binhostURL() areBinaries,areSources,needsConfig = sisyphus.resolveDeps.package(pkgname) if needsConfig == 0: @@ -28,7 +28,7 @@ def start(pkgname): if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary) - wget.download(isBinhost + binary) + wget.download(binhostURL + binary) print("\n") if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): @@ -61,7 +61,7 @@ def start(pkgname): if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary) - wget.download(isBinhost + binary) + wget.download(binhostURL + binary) print("\n") if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): diff --git a/src/backend/updateAll.py b/src/backend/updateAll.py index 7dfd157..c5809ab 100644 --- a/src/backend/updateAll.py +++ b/src/backend/updateAll.py @@ -4,7 +4,7 @@ import animation import sys import time import sisyphus.checkEnvironment -import sisyphus.getBinhost +import sisyphus.getEnvironment import sisyphus.purgeEnvironment import sisyphus.syncDatabase import sisyphus.syncEnvironment @@ -19,30 +19,30 @@ def syncAll(): @animation.wait('fetching updates') def start(): activeBranch = sisyphus.checkEnvironment.branch() - isBinhost = sisyphus.getBinhost.start() + binhostURL = sisyphus.getEnvironment.binhostURL() isSane = sisyphus.checkEnvironment.sanity() if isSane == 1: syncAll() else: - if "packages-next" in isBinhost: - print("\nCurrent branch: '" + activeBranch + "' (stable)" + "\nCurrent binhost: '" + isBinhost + "' (testing)") + if "packages-next" in binhostURL: + print("\nCurrent branch: '" + activeBranch + "' (stable)" + "\nCurrent binhost: '" + binhostURL + "' (testing)") else: - print("\nCurrent branch: '" + activeBranch + "' (testing)" + "\nCurrent binhost: '" + isBinhost + "' (stable)") + print("\nCurrent branch: '" + activeBranch + "' (testing)" + "\nCurrent binhost: '" + binhostURL + "' (stable)") sys.exit("\nInvalid branch - binhost pairing; Use 'sisyphus branch --help' for help; Quitting.") def startqt(): activeBranch = sisyphus.checkEnvironment.branch() - isBinhost = sisyphus.getBinhost.start() + binhostURL = sisyphus.getEnvironment.binhostURL() isSane = sisyphus.checkEnvironment.sanity() if isSane == 1: syncAll() else: - if "packages-next" in isBinhost: - print("\nCurrent branch: '" + activeBranch + "' (stable)" + "\nCurrent binhost: '" + isBinhost + "' (testing)") + if "packages-next" in binhostURL: + print("\nCurrent branch: '" + activeBranch + "' (stable)" + "\nCurrent binhost: '" + binhostURL + "' (testing)") else: - print("\nCurrent branch: '" + activeBranch + "' (testing)" + "\nCurrent binhost: '" + isBinhost + "' (stable)") + print("\nCurrent branch: '" + activeBranch + "' (testing)" + "\nCurrent binhost: '" + binhostURL + "' (stable)") print("\nInvalid branch - binhost pairing; Use 'sisyphus branch --help' for help; Quitting in 10 seconds.\n") t = int(10) while t: diff --git a/src/backend/upgradePkg.py b/src/backend/upgradePkg.py index 28a6220..ccddd99 100644 --- a/src/backend/upgradePkg.py +++ b/src/backend/upgradePkg.py @@ -8,7 +8,7 @@ import subprocess import sys import wget import sisyphus.checkEnvironment -import sisyphus.getBinhost +import sisyphus.getEnvironment import sisyphus.getFilesystem import sisyphus.killPortage import sisyphus.resolveDeps @@ -19,7 +19,7 @@ def start(): if sisyphus.checkEnvironment.root(): sisyphus.updateAll.start() - isBinhost = sisyphus.getBinhost.start() + binhostURL = sisyphus.getEnvironment.binhostURL() areBinaries,areSources,needsConfig = sisyphus.resolveDeps.world() if needsConfig == 0: @@ -30,7 +30,7 @@ def start(): if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y": for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary) - wget.download(isBinhost + binary) + wget.download(binhostURL + binary) print("\n") if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): @@ -64,7 +64,7 @@ def start(): sys.exit("\nYou need root permissions to do this, exiting!\n") def startqt(): - isBinhost = sisyphus.getBinhost.start() + binhostURL = sisyphus.getEnvironment.binhostURL() areBinaries,areSources,needsConfig = sisyphus.resolveDeps.world.__wrapped__() #undecorate if not len(areSources) == 0: @@ -75,7 +75,7 @@ def startqt(): print("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + " ".join(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n") for index, binary in enumerate([package + '.tbz2' for package in areBinaries], start=1): print(">>> Downloading binary ({}".format(index) + " " + "of" + " " + str(len(areBinaries)) + ")" + " " + binary) - wget.download(isBinhost + binary) + wget.download(binhostURL + binary) print("\n") if os.path.isdir(os.path.join(sisyphus.getFilesystem.portageCacheDir, binary.rstrip().split("/")[0])): diff --git a/src/backend/upgradeSrc.py b/src/backend/upgradeSrc.py index 9c226f9..1f50e18 100644 --- a/src/backend/upgradeSrc.py +++ b/src/backend/upgradeSrc.py @@ -7,7 +7,7 @@ import subprocess import sys import wget import sisyphus.checkEnvironment -import sisyphus.getBinhost +import sisyphus.getEnvironment import sisyphus.getFilesystem import sisyphus.resolveDeps import sisyphus.syncDatabase @@ -17,7 +17,7 @@ def start(): if sisyphus.checkEnvironment.root(): sisyphus.updateAll.start() - binhostURL = sisyphus.getBinhost.start() + binhostURL = sisyphus.getEnvironment.binhostURL() areBinaries,areSources,needsConfig = sisyphus.resolveDeps.world() if needsConfig == 0: -- cgit v1.2.3