From e3fa4634750ccceb23998fadefc249b35f86ca5b Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 8 Feb 2024 17:12:13 +0000 Subject: getcolor -> getclr --- src/backend/__init__.py | 2 +- src/backend/autoremove.py | 6 +-- src/backend/getclr.py | 9 ++++ src/backend/getcolor.py | 9 ---- src/backend/install.py | 106 ++++++++++++++++++++++---------------------- src/backend/searchdb.py | 74 +++++++++++++++---------------- src/backend/setbranch.py | 26 +++++------ src/backend/uninstall.py | 14 +++--- src/backend/update.py | 30 ++++++------- src/backend/upgrade.py | 110 +++++++++++++++++++++++----------------------- 10 files changed, 193 insertions(+), 193 deletions(-) create mode 100644 src/backend/getclr.py delete mode 100644 src/backend/getcolor.py diff --git a/src/backend/__init__.py b/src/backend/__init__.py index ccfb27a..b820950 100644 --- a/src/backend/__init__.py +++ b/src/backend/__init__.py @@ -1,7 +1,7 @@ from .autoremove import * from .checkenv import * from .dlpkg import * -from .getcolor import * +from .getclr import * from .getenv import * from .getfs import * from .install import * diff --git a/src/backend/autoremove.py b/src/backend/autoremove.py index 46a7991..3f0c852 100644 --- a/src/backend/autoremove.py +++ b/src/backend/autoremove.py @@ -6,7 +6,7 @@ import signal import subprocess import sys import sisyphus.checkenv -import sisyphus.getcolor +import sisyphus.getclr import sisyphus.killemerge import sisyphus.syncdb @@ -45,6 +45,6 @@ def start(gfx_ui=False): p_exe.wait() sisyphus.syncdb.lcl_tbl() else: - print(sisyphus.getcolor.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) sys.exit() diff --git a/src/backend/getclr.py b/src/backend/getclr.py new file mode 100644 index 0000000..8f4cf3b --- /dev/null +++ b/src/backend/getclr.py @@ -0,0 +1,9 @@ +#!/usr/bin/python3 + +bright_green = '\u001b[32;1m' +bright_red = '\u001b[31;1m' +bright_yellow = '\u001b[33;1m' +bright_white = '\u001b[37;1m' +green = '\u001b[32m' +magenta = '\u001b[35m' +reset = '\u001b[0m' diff --git a/src/backend/getcolor.py b/src/backend/getcolor.py deleted file mode 100644 index 8f4cf3b..0000000 --- a/src/backend/getcolor.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/python3 - -bright_green = '\u001b[32;1m' -bright_red = '\u001b[31;1m' -bright_yellow = '\u001b[33;1m' -bright_white = '\u001b[37;1m' -green = '\u001b[32m' -magenta = '\u001b[35m' -reset = '\u001b[0m' diff --git a/src/backend/install.py b/src/backend/install.py index 5e9b3b8..8dab0ef 100644 --- a/src/backend/install.py +++ b/src/backend/install.py @@ -10,7 +10,7 @@ import sys import time import sisyphus.checkenv import sisyphus.dlpkg -import sisyphus.getcolor +import sisyphus.getclr import sisyphus.getfs import sisyphus.killemerge import sisyphus.solvedeps @@ -27,8 +27,8 @@ signal.signal(signal.SIGINT, sigint_handler) def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): if not sisyphus.checkenv.root(): - print(sisyphus.getcolor.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) sys.exit() else: if gfx_ui: @@ -80,28 +80,28 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): sys.exit(app.exec_()) # kill GUI window else: - print(sisyphus.getcolor.bright_red + - "\nCannot proceed!\n" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + - "Apply the above changes to your portage configuration files and try again!" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nCannot proceed!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + + "Apply the above changes to your portage configuration files and try again!" + sisyphus.getclr.reset) sys.exit() else: if len(bin_list) == 0 and len(src_list) == 0: - print(sisyphus.getcolor.bright_red + - "\nNo package found!\n" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nNo package found!\n" + sisyphus.getclr.reset) sys.exit() if ebuild: # ebuild mode if len(bin_list) == 0 and len(src_list) != 0: # source mode, ignore aliens - print("\n" + sisyphus.getcolor.green + - "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.green + - ", ".join(src_list) + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str( - len(src_list)) + " " + "source package(s)" + sisyphus.getcolor.reset + "\n") + print("\n" + sisyphus.getclr.green + + "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.green + + ", ".join(src_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") while True: - user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + - "[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ") + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname)) @@ -123,22 +123,22 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): user_input + "'" + " " + "not understood.\n") continue elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens - print("\n" + sisyphus.getcolor.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.magenta + - ", ".join(bin_list) + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n") + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getcolor.green + - "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.green + - ", ".join(src_list) + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str( - len(src_list)) + " " + "source package(s)" + sisyphus.getcolor.reset + "\n") + print("\n" + sisyphus.getclr.green + + "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.green + + ", ".join(src_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") while True: - user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + - "[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ") + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlpkg.start(dl_world=False, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -162,15 +162,15 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): user_input + "'" + " " + "not understood.\n") continue elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback - print("\n" + sisyphus.getcolor.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.magenta + - ", ".join(bin_list) + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n") + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") while True: - user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + - "[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ") + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlpkg.start(dl_world=False, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -206,9 +206,9 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): sys.exit(app.exec_()) # kill GUI window else: - print(sisyphus.getcolor.bright_red + - "\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " + + print(sisyphus.getclr.bright_red + + "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "Use" + sisyphus.getclr.reset + " " + "'" + "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'") sys.exit() elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode (noop), catch aliens @@ -223,9 +223,9 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): sys.exit(app.exec_()) # kill GUI window else: - print(sisyphus.getcolor.bright_red + - "\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " + + print(sisyphus.getclr.bright_red + + "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "Use" + sisyphus.getclr.reset + " " + "'" + "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'") sys.exit() elif len(bin_list) != 0 and len(src_list) == 0: # binary mode @@ -247,15 +247,15 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): p_exe.wait() sisyphus.syncdb.lcl_tbl() else: - print("\n" + sisyphus.getcolor.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.magenta + - ", ".join(bin_list) + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n") + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") while True: - user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + - "[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ") + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlpkg.start( dl_world=False, gfx_ui=False) diff --git a/src/backend/searchdb.py b/src/backend/searchdb.py index 22bd4ba..e344cb2 100644 --- a/src/backend/searchdb.py +++ b/src/backend/searchdb.py @@ -4,7 +4,7 @@ import signal import sqlite3 import subprocess import sisyphus.checkenv -import sisyphus.getcolor +import sisyphus.getclr import sisyphus.getfs import sisyphus.update @@ -115,68 +115,68 @@ def tosql(string): def srch_rslt(filter, cat, pn, desc, single): - print("\nSearching" + sisyphus.getcolor.bright_yellow + " " + - f"{filter}" + " " + sisyphus.getcolor.reset + "packages ..." + "\n") + print("\nSearching" + sisyphus.getclr.bright_yellow + " " + + f"{filter}" + " " + sisyphus.getclr.reset + "packages ..." + "\n") pkglist = srch_db(filter, tosql(cat), tosql(pn), tosql(desc)) if len(pkglist) == 0: - print(sisyphus.getcolor.bright_red + - "No binary package found!\n" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + "Use the" + sisyphus.getcolor.reset + " " + "'" + "--ebuild" + - "'" + " " + sisyphus.getcolor.bright_yellow + "option to search source packages" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " + "'" + - "sisyphus search --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "No binary package found!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "Use the" + sisyphus.getclr.reset + " " + "'" + "--ebuild" + + "'" + " " + sisyphus.getclr.bright_yellow + "option to search source packages" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "Use" + sisyphus.getclr.reset + " " + "'" + + "sisyphus search --help" + "'" + " " + sisyphus.getclr.bright_yellow + "for help" + sisyphus.getclr.reset) else: if single: - print(sisyphus.getcolor.green + - f"{'Package category/name':45} {'Installed version':20} {'Latest available version':30} {'Description'}" + sisyphus.getcolor.reset) + print(sisyphus.getclr.green + + f"{'Package category/name':45} {'Installed version':20} {'Latest available version':30} {'Description'}" + sisyphus.getclr.reset) for pkg in pkglist: if not single: - print(sisyphus.getcolor.bright_green + "*" + " " + sisyphus.getcolor.reset + - sisyphus.getcolor.bright_white + f"{pkg['cat']}/{pkg['pn']}" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.green + "\tInstalled version:" + - " " + sisyphus.getcolor.reset + f"{pkg['iv']}") + print(sisyphus.getclr.bright_green + "*" + " " + sisyphus.getclr.reset + + sisyphus.getclr.bright_white + f"{pkg['cat']}/{pkg['pn']}" + sisyphus.getclr.reset) + print(sisyphus.getclr.green + "\tInstalled version:" + + " " + sisyphus.getclr.reset + f"{pkg['iv']}") if pkg['av'] != 'alien': - print(sisyphus.getcolor.green + "\tLatest available version:" + - " " + sisyphus.getcolor.reset + f"{pkg['av']}") + print(sisyphus.getclr.green + "\tLatest available version:" + + " " + sisyphus.getclr.reset + f"{pkg['av']}") else: - print(sisyphus.getcolor.green + "\tAlien package:" + " " + sisyphus.getcolor.reset + + print(sisyphus.getclr.green + "\tAlien package:" + " " + sisyphus.getclr.reset + "Use `sisyphus search --ebuild" + " " + f"{pkg['pn']}`" + " " + "for available version!") - print(sisyphus.getcolor.green + "\tDescription:" + " " + - sisyphus.getcolor.reset + f"{pkg['desc']}" + "\n") + print(sisyphus.getclr.green + "\tDescription:" + " " + + sisyphus.getclr.reset + f"{pkg['desc']}" + "\n") else: cpn = f"{pkg['cat']}/{pkg['pn']}" - print(sisyphus.getcolor.bright_white + f"{cpn:45}" + " " + sisyphus.getcolor.reset + + print(sisyphus.getclr.bright_white + f"{cpn:45}" + " " + sisyphus.getclr.reset + f"{str(pkg['iv']):20}" + " " + f"{str(pkg['av']):30}" + " " + f"{str(pkg['desc'])}") - print("\nFound" + " " + sisyphus.getcolor.bright_yellow + - f"{len(pkglist)}" + " " + sisyphus.getcolor.reset + "matching package(s) ...") + print("\nFound" + " " + sisyphus.getclr.bright_yellow + + f"{len(pkglist)}" + " " + sisyphus.getclr.reset + "matching package(s) ...") def start(filter, cat, pn, desc, single): if sisyphus.checkenv.root(): - print(sisyphus.getcolor.bright_red + - "\nSearching as root, database can be updated!\n" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + - "Search results will be accurate\n" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nSearching as root, database can be updated!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + + "Search results will be accurate\n" + sisyphus.getclr.reset) while True: - user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + - "[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ") + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: sisyphus.update.start(gfx_ui=False) break elif user_input.lower() in ['no', 'n']: - print(sisyphus.getcolor.bright_red + - "\nSkipping database update, displaying search results!\n" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + - "Search results may be inaccurate" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nSkipping database update, displaying search results!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + + "Search results may be inaccurate" + sisyphus.getclr.reset) break else: continue else: - print(sisyphus.getcolor.bright_red + - "\nSearching as user, database cannot be updated!\n" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + - "Search results may be inaccurate" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nSearching as user, database cannot be updated!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + + "Search results may be inaccurate" + sisyphus.getclr.reset) srch_rslt(filter, cat, pn, desc, single) diff --git a/src/backend/setbranch.py b/src/backend/setbranch.py index ffec3b8..05b6c5c 100644 --- a/src/backend/setbranch.py +++ b/src/backend/setbranch.py @@ -7,7 +7,7 @@ import random import signal import sys import sisyphus.checkenv -import sisyphus.getcolor +import sisyphus.getclr import sisyphus.getfs import sisyphus.mirrors import sisyphus.purgeenv @@ -97,16 +97,16 @@ def set_brch_next_index(): def set_bhst_index(branch, remote): if "master" in branch: - print(sisyphus.getcolor.green + "\nActive branch switched:" + - " " + sisyphus.getcolor.reset + "'" + branch + "'") - print(sisyphus.getcolor.green + "Active remote switched:" + - " " + sisyphus.getcolor.reset + "'" + remote + "'") + print(sisyphus.getclr.green + "\nActive branch switched:" + + " " + sisyphus.getclr.reset + "'" + branch + "'") + print(sisyphus.getclr.green + "Active remote switched:" + + " " + sisyphus.getclr.reset + "'" + remote + "'") set_brch_master_index() # Set binhost index for branch 'master' (random odd index) elif "next" in branch: - print(sisyphus.getcolor.green + "\nActive branch switched:" + - " " + sisyphus.getcolor.reset + "'" + branch + "'") - print(sisyphus.getcolor.green + "Active remote switched:" + - " " + sisyphus.getcolor.reset + "'" + remote + "'") + print(sisyphus.getclr.green + "\nActive branch switched:" + + " " + sisyphus.getclr.reset + "'" + branch + "'") + print(sisyphus.getclr.green + "Active remote switched:" + + " " + sisyphus.getclr.reset + "'" + remote + "'") set_brch_next_index() # Set binhost index for branch 'next' (random even index) @@ -124,10 +124,10 @@ def start(branch, remote): sisyphus.setprofile.start() set_bhst_index(branch, remote) else: - print(sisyphus.getcolor.bright_red + - "\nNo internet connection; Aborting!\n" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nNo internet connection; Aborting!\n" + sisyphus.getclr.reset) sys.exit() else: - print(sisyphus.getcolor.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) sys.exit() diff --git a/src/backend/uninstall.py b/src/backend/uninstall.py index 3900f4b..e3e6135 100644 --- a/src/backend/uninstall.py +++ b/src/backend/uninstall.py @@ -8,7 +8,7 @@ import signal import subprocess import sys import sisyphus.checkenv -import sisyphus.getcolor +import sisyphus.getclr import sisyphus.getfs import sisyphus.killemerge import sisyphus.solverdeps @@ -26,8 +26,8 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): args = ['--quiet', '--depclean'] if not sisyphus.checkenv.root() and (unmerge or depclean): - print(sisyphus.getcolor.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) sys.exit() else: if gfx_ui: @@ -62,10 +62,10 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): except subprocess.TimeoutExpired: p_exe.kill() sys.exit() - print(sisyphus.getcolor.bright_red + - "\nWon't uninstall! Other packages depend on " + sisyphus.getcolor.reset + str(pkgname)) - print(sisyphus.getcolor.bright_red + "Use the " + sisyphus.getcolor.reset + sisyphus.getcolor.green + "'--force'" + - sisyphus.getcolor.reset + sisyphus.getcolor.bright_red + " option to override at your own risk!\n" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nWon't uninstall! Other packages depend on " + sisyphus.getclr.reset + str(pkgname)) + print(sisyphus.getclr.bright_red + "Use the " + sisyphus.getclr.reset + sisyphus.getclr.green + "'--force'" + + sisyphus.getclr.reset + sisyphus.getclr.bright_red + " option to override at your own risk!\n" + sisyphus.getclr.reset) else: if unmerge: p_exe = subprocess.Popen( diff --git a/src/backend/update.py b/src/backend/update.py index 146045c..d6db8ff 100644 --- a/src/backend/update.py +++ b/src/backend/update.py @@ -5,7 +5,7 @@ import signal import sys import time import sisyphus.checkenv -import sisyphus.getcolor +import sisyphus.getclr import sisyphus.getenv import sisyphus.purgeenv import sisyphus.syncdb @@ -42,8 +42,8 @@ def start(gfx_ui=False): sys.exit(app.exec_()) # kill GUI window else: - print(sisyphus.getcolor.bright_red + - "\n\nNo internet connection; Aborting!\n" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\n\nNo internet connection; Aborting!\n" + sisyphus.getclr.reset) sys.exit() else: if is_sane == 1: @@ -70,19 +70,19 @@ def start(gfx_ui=False): sys.exit(app.exec_()) # kill GUI window else: if "packages-next" in bhst_addr: - print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + - sisyphus.getcolor.reset + "'" + actv_brch + "'" + " " + "(stable)") - print(sisyphus.getcolor.green + "\nActive binhost:" + " " + - sisyphus.getcolor.reset + "'" + bhst_addr + "'" + " " + "(testing)") + print(sisyphus.getclr.green + "\n\nActive branch:" + " " + + sisyphus.getclr.reset + "'" + actv_brch + "'" + " " + "(stable)") + print(sisyphus.getclr.green + "\nActive binhost:" + " " + + sisyphus.getclr.reset + "'" + bhst_addr + "'" + " " + "(testing)") else: - print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + - sisyphus.getcolor.reset + "'" + actv_brch + "'" + " " + "(testing)") - print(sisyphus.getcolor.green + "\nActive binhost:" + " " + - sisyphus.getcolor.reset + "'" + bhst_addr + "'" + " " + "(stable)") + print(sisyphus.getclr.green + "\n\nActive branch:" + " " + + sisyphus.getclr.reset + "'" + actv_brch + "'" + " " + "(testing)") + print(sisyphus.getclr.green + "\nActive binhost:" + " " + + sisyphus.getclr.reset + "'" + bhst_addr + "'" + " " + "(stable)") - print(sisyphus.getcolor.bright_red + - "\n\nInvalid configuration!" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + "\nUse" + sisyphus.getcolor.reset + " " + "'" + - "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\n\nInvalid configuration!" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "\nUse" + sisyphus.getclr.reset + " " + "'" + + "sisyphus branch --help" + "'" + " " + sisyphus.getclr.bright_yellow + "for help" + sisyphus.getclr.reset) time.sleep(1) sys.exit() diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py index cec6061..61e40ed 100644 --- a/src/backend/upgrade.py +++ b/src/backend/upgrade.py @@ -10,7 +10,7 @@ import sys import time import sisyphus.checkenv import sisyphus.dlpkg -import sisyphus.getcolor +import sisyphus.getclr import sisyphus.getfs import sisyphus.killemerge import sisyphus.solvedeps @@ -27,8 +27,8 @@ signal.signal(signal.SIGINT, sigint_handler) def start(ebuild=False, gfx_ui=False): if not sisyphus.checkenv.root(): - print(sisyphus.getcolor.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) sys.exit() else: if gfx_ui: @@ -63,31 +63,31 @@ def start(ebuild=False, gfx_ui=False): sys.exit(app.exec_()) # kill GUI window else: - print(sisyphus.getcolor.bright_red + - "\nCannot proceed!\n" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + - "Apply the above changes to your portage configuration files and try again" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nCannot proceed!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + + "Apply the above changes to your portage configuration files and try again" + sisyphus.getclr.reset) sys.exit() else: if len(bin_list) == 0 and len(src_list) == 0: if gfx_ui: print("\nNo package upgrades found!\n") else: - print(sisyphus.getcolor.bright_red + - "\nNo package upgrades found!\n" + sisyphus.getcolor.reset) + print(sisyphus.getclr.bright_red + + "\nNo package upgrades found!\n" + sisyphus.getclr.reset) sys.exit() if ebuild: # ebuild mode if len(bin_list) == 0 and len(src_list) != 0: # source mode, ignore aliens - print("\n" + sisyphus.getcolor.green + - "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.green + - ", ".join(src_list) + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str( - len(src_list)) + " " + "source package(s)" + sisyphus.getcolor.reset + "\n") + print("\n" + sisyphus.getclr.green + + "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.green + + ", ".join(src_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") while True: - user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + - "[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ") + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) @@ -109,22 +109,22 @@ def start(ebuild=False, gfx_ui=False): user_input + "'" + " " + "not understood.\n") continue elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens - print("\n" + sisyphus.getcolor.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.magenta + - ", ".join(bin_list) + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n") + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") - print("\n" + sisyphus.getcolor.green + - "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.green + - ", ".join(src_list) + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str( - len(src_list)) + " " + "source package(s)" + sisyphus.getcolor.reset + "\n") + print("\n" + sisyphus.getclr.green + + "These are the source packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.green + + ", ".join(src_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(src_list)) + " " + "source package(s)" + sisyphus.getclr.reset + "\n") while True: - user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + - "[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ") + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlpkg.start(dl_world=True, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -148,15 +148,15 @@ def start(ebuild=False, gfx_ui=False): user_input + "'" + " " + "not understood.\n") continue elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback - print("\n" + sisyphus.getcolor.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.magenta + - ", ".join(bin_list) + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n") + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") while True: - user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + - "[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ") + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlpkg.start(dl_world=True, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -192,10 +192,10 @@ def start(ebuild=False, gfx_ui=False): sys.exit(app.exec_()) # kill GUI window else: - print(sisyphus.getcolor.bright_red + - "\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + "Use" + - sisyphus.getcolor.reset + " " + "'" + "sisyphus upgrade --ebuild" + "'") + print(sisyphus.getclr.bright_red + + "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "Use" + + sisyphus.getclr.reset + " " + "'" + "sisyphus upgrade --ebuild" + "'") sys.exit() elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode (noop), catch aliens if gfx_ui: @@ -209,10 +209,10 @@ def start(ebuild=False, gfx_ui=False): sys.exit(app.exec_()) # kill GUI window else: - print(sisyphus.getcolor.bright_red + - "\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + "Use" + - sisyphus.getcolor.reset + " " + "'" + "sisyphus upgrade --ebuild" + "'") + print(sisyphus.getclr.bright_red + + "\nSource package(s) found in the mix!\n" + sisyphus.getclr.reset) + print(sisyphus.getclr.bright_yellow + "Use" + + sisyphus.getclr.reset + " " + "'" + "sisyphus upgrade --ebuild" + "'") sys.exit() elif len(bin_list) != 0 and len(src_list) == 0: # binary mode if gfx_ui: @@ -233,15 +233,15 @@ def start(ebuild=False, gfx_ui=False): p_exe.wait() sisyphus.syncdb.lcl_tbl() else: - print("\n" + sisyphus.getcolor.green + - "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.magenta + - ", ".join(bin_list) + sisyphus.getcolor.reset + "\n") - print("\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str( - len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n") + print("\n" + sisyphus.getclr.green + + "These are the binary packages that would be merged, in order:" + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.magenta + + ", ".join(bin_list) + sisyphus.getclr.reset + "\n") + print("\n" + sisyphus.getclr.bright_white + "Total:" + " " + str( + len(bin_list)) + " " + "binary package(s)" + sisyphus.getclr.reset + "\n") while True: - user_input = input(sisyphus.getcolor.bright_white + "Would you like to proceed?" + sisyphus.getcolor.reset + " " + - "[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ") + user_input = input(sisyphus.getclr.bright_white + "Would you like to proceed?" + sisyphus.getclr.reset + " " + + "[" + sisyphus.getclr.bright_green + "Yes" + sisyphus.getclr.reset + "/" + sisyphus.getclr.bright_red + "No" + sisyphus.getclr.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlpkg.start( dl_world=True, gfx_ui=False) -- cgit v1.2.3