diff options
-rw-r--r-- | src/backend/__init__.py | 1 | ||||
-rw-r--r-- | src/backend/checkenv.py | 2 | ||||
-rw-r--r-- | src/backend/getclr.py | 9 | ||||
-rw-r--r-- | src/backend/getnews.py | 21 | ||||
-rw-r--r-- | src/backend/pkgadd.py | 62 | ||||
-rw-r--r-- | src/backend/pkgremove.py | 33 | ||||
-rw-r--r-- | src/backend/searchdb.py | 35 | ||||
-rw-r--r-- | src/backend/setbranch.py | 13 | ||||
-rw-r--r-- | src/backend/syncall.py | 23 | ||||
-rw-r--r-- | src/backend/sysclean.py | 120 | ||||
-rw-r--r-- | src/backend/sysupgrade.py | 59 |
11 files changed, 204 insertions, 174 deletions
diff --git a/src/backend/__init__.py b/src/backend/__init__.py index 6c7da46..d6c6e88 100644 --- a/src/backend/__init__.py +++ b/src/backend/__init__.py @@ -1,7 +1,6 @@ from .checkenv import * from .depsolve import * from .dlbinpkg import * -from .getclr import * from .getenv import * from .getfs import * from .getnews import * diff --git a/src/backend/checkenv.py b/src/backend/checkenv.py index 8030bc9..d36aa5c 100644 --- a/src/backend/checkenv.py +++ b/src/backend/checkenv.py @@ -11,7 +11,7 @@ from urllib.error import HTTPError NETWORK_CHECK_URL_FILE = os.path.join( - sisyphus.getfs.s_cfg_dir, "network_check_url.conf") + sisyphus.getfs.s_cfg_dir, "sisyphus.net_chk_addr.conf") def is_valid_url(url): diff --git a/src/backend/getclr.py b/src/backend/getclr.py deleted file mode 100644 index 8f4cf3b..0000000 --- a/src/backend/getclr.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/getnews.py b/src/backend/getnews.py index f222978..628f7ea 100644 --- a/src/backend/getnews.py +++ b/src/backend/getnews.py @@ -1,8 +1,11 @@ #!/usr/bin/python3 +import colorama import os -import sisyphus.getclr import sisyphus.getfs +from colorama import Fore, Back, Style + +colorama.init() NEWS_DIR = "news" @@ -43,15 +46,15 @@ def mark_read(article_nr): if article_index in r_news_index: print( - f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} is already marked as {sisyphus.getclr.bright_green}read{sisyphus.getclr.reset}.") + f"\nArticle {Fore.WHITE}{Style.BRIGHT}{article_nr}{Style.RESET_ALL} is already marked as {Fore.GREEN}{Style.BRIGHT}read{Style.RESET_ALL}.") else: r_news_index.append(article_index) save_r_news(r_news_index) print( - f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} marked as {sisyphus.getclr.bright_green}read{sisyphus.getclr.reset}.") + f"\nArticle {Fore.WHITE}{Style.BRIGHT}{article_nr}{Style.RESET_ALL} marked as {Fore.GREEN}{Style.BRIGHT}read{Style.RESET_ALL}.") else: print( - f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} doesn't exist.") + f"\nArticle {Fore.WHITE}{Style.BRIGHT}{article_nr}{Style.RESET_ALL} doesn't exist.") def mark_unread(article_nr): @@ -63,15 +66,15 @@ def mark_unread(article_nr): if article_index not in r_news_index: print( - f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} is already marked as {sisyphus.getclr.bright_red}unread{sisyphus.getclr.reset}.") + f"\nArticle {Fore.WHITE}{Style.BRIGHT}{article_nr}{Style.RESET_ALL} is already marked as {Fore.RED}{Style.BRIGHT}unread{Style.RESET_ALL}.") else: r_news_index.remove(article_index) save_r_news(r_news_index) print( - f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} marked as {sisyphus.getclr.bright_red}unread{sisyphus.getclr.reset}.") + f"\nArticle {Fore.WHITE}{Style.BRIGHT}{article_nr}{Style.RESET_ALL} marked as {Fore.RED}{Style.BRIGHT}unread{Style.RESET_ALL}.") else: print( - f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} doesn't exist.") + f"\nArticle {Fore.WHITE}{Style.BRIGHT}{article_nr}{Style.RESET_ALL} doesn't exist.") def list_all_news(): @@ -79,9 +82,9 @@ def list_all_news(): r_news_index = ld_r_news() for index, news in enumerate(n_news): - status = f"{sisyphus.getclr.bright_green}Read{sisyphus.getclr.reset}" if index in r_news_index else f"{sisyphus.getclr.bright_red}Unread{sisyphus.getclr.reset}" + status = f"{Fore.GREEN}{Style.BRIGHT}Read{Style.RESET_ALL}" if index in r_news_index else f"{Fore.RED}{Style.BRIGHT}Unread{Style.RESET_ALL}" print( - f"\n{sisyphus.getclr.bright_yellow}Article {sisyphus.getclr.bright_white}{index + 1}{sisyphus.getclr.reset} ({status}):\n\n{news}") + f"\n{Fore.MAGENTA}{Style.BRIGHT}Article {index + 1}{Style.RESET_ALL} ({status}):\n\n{news}") def start(list=False, read=False, unread=False, article_nr=None): diff --git a/src/backend/pkgadd.py b/src/backend/pkgadd.py index a64196c..1a8e844 100644 --- a/src/backend/pkgadd.py +++ b/src/backend/pkgadd.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 import atexit +import colorama import fcntl import io import os @@ -13,11 +14,13 @@ import time import sisyphus.checkenv import sisyphus.depsolve import sisyphus.dlbinpkg -import sisyphus.getclr import sisyphus.getfs import sisyphus.syncdb import sisyphus.syncall import sisyphus.watchdog +from colorama import Fore, Back, Style + +colorama.init() def set_nonblocking(fd): @@ -53,7 +56,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False): nogo_args = ['--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] if not sisyphus.checkenv.root(): - print(f"{sisyphus.getclr.bright_red}\nRoot permissions are required for this operation.\n{sisyphus.getclr.reset}") + print(f"{Fore.RED}{Style.BRIGHT}\nRoot permissions are required for this operation.\n{Style.RESET_ALL}") sys.exit() else: if gfx_ui: @@ -106,22 +109,22 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False): os.kill(os.getpid(), signal.SIGTERM) # kill GUI window else: - print(f"{sisyphus.getclr.bright_red}\nCannot proceed!\n{sisyphus.getclr.reset}{sisyphus.getclr.bright_yellow}Please apply the above changes to your portage configuration files and try again!{sisyphus.getclr.reset}") + print(f"{Fore.RED}{Style.BRIGHT}\nCannot proceed!\n{Style.RESET_ALL}{Fore.WHITE}{Style.BRIGHT}Please apply the above changes to your portage configuration files and try again!{Style.RESET_ALL}") sys.exit() else: if len(bin_list) == 0 and len(src_list) == 0: - print(f"{sisyphus.getclr.bright_red}\nOne or more of the selected packages cannot be located for installation.\n{sisyphus.getclr.reset}") + print(f"{Fore.RED}{Style.BRIGHT}\nOne or more of the selected packages cannot be located for installation.\n{Style.RESET_ALL}") if ebuild: # ebuild mode if len(bin_list) == 0 and len(src_list) != 0: # source mode, ignore aliens print( - f"\n{sisyphus.getclr.green}These are the source packages that would be merged, in order:{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}These are the source packages that would be merged, in order:{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.green}{', '.join(src_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}{', '.join(src_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(src_list)} source package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(src_list)} source package(s){Style.RESET_ALL}\n") while True: user_input = input( - f"{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}] ") + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if user_input.lower() in ['yes', 'y', '']: p_exe = subprocess.Popen(['emerge'] + go_args + (['--nodeps'] if nodeps else [ '--with-bdeps=y']) + (['--oneshot'] if oneshot else []) + list(pkgname)) @@ -160,21 +163,21 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False): continue elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens print( - f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}These are the binary packages that would be merged, in order:{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.MAGENTA}{', '.join(bin_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(bin_list)} binary package(s){Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.green}These are the source packages that would be merged, in order:{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}These are the source packages that would be merged, in order:{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.green}{', '.join(src_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}{', '.join(src_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(src_list)} source package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(src_list)} source package(s){Style.RESET_ALL}\n") while True: user_input = input( - f"{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}] ") + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlbinpkg.start(dl_world=False, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -215,14 +218,14 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False): continue elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback print( - f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}These are the binary packages that would be merged, in order:{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.MAGENTA}{', '.join(bin_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(bin_list)} binary package(s){Style.RESET_ALL}\n") while True: user_input = input( - f"{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}] ") + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlbinpkg.start(dl_world=False, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -275,8 +278,9 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False): os.kill(os.getpid(), signal.SIGTERM) # kill GUI window else: print( - f"{sisyphus.getclr.bright_red}\nSource package(s) found in the mix!\n{sisyphus.getclr.reset}") - print(f"{sisyphus.getclr.bright_yellow}Use{sisyphus.getclr.reset} 'sisyphus install {' '.join(pkgname)} --ebuild' to perform the install; Aborting.") + f"{Fore.RED}{Style.BRIGHT}\nSource package(s) found in the mix!\n{Style.RESET_ALL}") + print( + f"{Fore.WHITE}{Style.BRIGHT}Use 'sisyphus install {' '.join(pkgname)} --ebuild' to perform the install; Aborting.{Style.RESET_ALL}") sys.exit() elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode (noop), catch aliens if gfx_ui: @@ -291,8 +295,9 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False): os.kill(os.getpid(), signal.SIGTERM) # kill GUI window else: print( - f"{sisyphus.getclr.bright_red}\nSource package(s) found in the mix!\n{sisyphus.getclr.reset}") - print(f"{sisyphus.getclr.bright_yellow}Use{sisyphus.getclr.reset} 'sisyphus install {' '.join(pkgname)} --ebuild' to perform the install; Aborting.") + f"{Fore.RED}{Style.BRIGHT}\nSource package(s) found in the mix!\n{Style.RESET_ALL}") + print( + f"{Fore.WHITE}{Style.BRIGHT}Use 'sisyphus install {' '.join(pkgname)} --ebuild' to perform the install; Aborting.{Style.RESET_ALL}") sys.exit() elif len(bin_list) != 0 and len(src_list) == 0: # binary mode if gfx_ui: @@ -303,7 +308,8 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False): sisyphus.dlbinpkg.start(dl_world=False, gfx_ui=True) os.chdir(sisyphus.getfs.p_cch_dir) p_exe = subprocess.Popen(['emerge'] + go_args + ['--usepkg', '--usepkgonly', '--rebuilt-binaries'] + ( - ['--nodeps'] if nodeps else ['--with-bdeps=y']) + (['--oneshot'] if oneshot else []) + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # --nodeps && --oneshot are set to False in the graphical client + # --nodeps && --oneshot are set to False in the graphical client + ['--nodeps'] if nodeps else ['--with-bdeps=y']) + (['--oneshot'] if oneshot else []) + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # kill portage if the program dies or it's terminated by the user atexit.register(sisyphus.watchdog.start, p_exe) @@ -314,14 +320,14 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False, nodeps=False): sisyphus.syncdb.lcl_tbl() else: print( - f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}These are the binary packages that would be merged, in order:{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.MAGENTA}{', '.join(bin_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(bin_list)} binary package(s){Style.RESET_ALL}\n") while True: user_input = input( - f"{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}] ") + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlbinpkg.start( dl_world=False, gfx_ui=False) diff --git a/src/backend/pkgremove.py b/src/backend/pkgremove.py index e9b36b8..eb60ad0 100644 --- a/src/backend/pkgremove.py +++ b/src/backend/pkgremove.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 import atexit +import colorama import fcntl import io import os @@ -11,11 +12,13 @@ import subprocess import sys import time import sisyphus.checkenv -import sisyphus.getclr import sisyphus.getfs import sisyphus.revdepsolve import sisyphus.syncdb import sisyphus.watchdog +from colorama import Fore, Back, Style + +colorama.init() def set_nonblocking(fd): @@ -49,7 +52,7 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): args = ['--quiet', '--depclean'] if not sisyphus.checkenv.root() and (unmerge or depclean): - print(f"{sisyphus.getclr.bright_red}\nRoot permissions are required to perform this action.\n{sisyphus.getclr.reset}") + print(f"{Fore.RED}{Style.BRIGHT}\nRoot permissions are required to perform this action.\n{Style.RESET_ALL}") sys.exit() else: if gfx_ui: @@ -144,8 +147,9 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): sys.exit() finally: p_exe.wait() - print(f"{sisyphus.getclr.bright_red}\nUnable to proceed! Other packages have dependencies preventing removal.{sisyphus.getclr.reset}") - print(f"{sisyphus.getclr.bright_white}Use the {sisyphus.getclr.reset}{sisyphus.getclr.green}'--force'{sisyphus.getclr.reset}{sisyphus.getclr.bright_white} option to override at your own risk!{sisyphus.getclr.reset}\n") + print( + f"{Fore.RED}{Style.BRIGHT}\nUnable to proceed! Other packages have dependencies preventing removal.{Style.RESET_ALL}") + print(f"{Fore.WHITE}{Style.BRIGHT}Use the {Style.RESET_ALL}{Fore.GREEN}'--force'{Style.RESET_ALL}{Fore.WHITE}{Style.BRIGHT} option to override at your own risk!{Style.RESET_ALL}\n") sys.exit() else: if is_installed == 0: @@ -158,22 +162,22 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): os.kill(os.getpid(), signal.SIGTERM) # kill GUI window else: - print(f"{sisyphus.getclr.bright_red}\nUnable to proceed! One or more selected packages could not be located for removal.\n{sisyphus.getclr.reset}") + print(f"{Fore.RED}{Style.BRIGHT}\nUnable to proceed! One or more selected packages could not be located for removal.\n{Style.RESET_ALL}") sys.exit() else: if unmerge: - print(f"\n{sisyphus.getclr.green}These are the selected packages that would be{sisyphus.getclr.reset} 'forcefully' {sisyphus.getclr.green}unmerged, in order:{sisyphus.getclr.reset}\n") + print(f"\n{Fore.GREEN}These are the selected packages that would be{Style.RESET_ALL} 'forcefully' {Fore.GREEN}unmerged, in order:{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.magenta}{', '.join(rm_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.MAGENTA}{', '.join(rm_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(rm_list)} selected package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(rm_list)} selected package(s){Style.RESET_ALL}\n") while True: user_input = input( - f"{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}] ") + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if user_input.lower() in ['yes', 'y', '']: while True: confirmation_input = input( - f"{sisyphus.getclr.bright_white}Are you sure you would like to proceed?{sisyphus.getclr.reset} [{sisyphus.getclr.bright_green}Yes{sisyphus.getclr.reset}/{sisyphus.getclr.bright_red}No{sisyphus.getclr.reset}] ") + f"{Fore.WHITE}{Style.BRIGHT}Are you sure you would like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if confirmation_input.lower() in ['yes', 'y', '']: p_exe = subprocess.Popen( ['emerge', '--quiet', '--unmerge'] + list(pkgname)) @@ -231,15 +235,16 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): p_exe.wait() sisyphus.syncdb.lcl_tbl() else: - print(f"\n{sisyphus.getclr.green}These are the selected packages that would be{sisyphus.getclr.reset} 'safely' {sisyphus.getclr.green}unmerged, in order:{sisyphus.getclr.reset}\n") print( - f"\n{sisyphus.getclr.magenta}{', '.join(rm_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}These are the selected packages that would be{Style.RESET_ALL} 'safely' {Fore.GREEN}unmerged, in order:{Style.RESET_ALL}\n") + print( + f"\n{Fore.MAGENTA}{', '.join(rm_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(rm_list)} selected package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(rm_list)} selected package(s){Style.RESET_ALL}\n") while True: user_input = input( - f"{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}] ") + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if user_input.lower() in ['yes', 'y', '']: p_exe = subprocess.Popen( ['emerge'] + args + list(pkgname)) diff --git a/src/backend/searchdb.py b/src/backend/searchdb.py index 36e3cb6..91d632f 100644 --- a/src/backend/searchdb.py +++ b/src/backend/searchdb.py @@ -1,13 +1,16 @@ #!/usr/bin/python3 +import colorama import signal import sqlite3 import subprocess import sisyphus.checkenv -import sisyphus.getclr import sisyphus.getfs import sisyphus.querydb import sisyphus.syncall +from colorama import Fore, Back, Style + +colorama.init() def sigint_handler(signal, frame): @@ -35,54 +38,54 @@ def tosql(string): def srch_rslt(filter, cat, pn, desc, single): print( - f"\nSearching {sisyphus.getclr.bright_yellow}{filter}{sisyphus.getclr.reset} packages...\n") + f"\nSearching {Fore.WHITE}{Style.BRIGHT}{filter}{Style.RESET_ALL} packages...\n") pkglist = srch_db(filter, tosql(cat), tosql(pn), tosql(desc)) if len(pkglist) == 0: print( - f"{sisyphus.getclr.bright_red}No matching packages have been identified!{sisyphus.getclr.reset}") - print(f"{sisyphus.getclr.bright_yellow}Use the '{'--ebuild'}' option to search source packages{sisyphus.getclr.reset}") - print(f"{sisyphus.getclr.bright_yellow}Use '{'sisyphus search --help'}' for assistance{sisyphus.getclr.reset}") + f"{Fore.RED}{Style.BRIGHT}No matching packages have been identified!{Style.RESET_ALL}") + print(f"{Fore.WHITE}{Style.BRIGHT}Use the '{'--ebuild'}' option to search source packages{Style.RESET_ALL}") + print(f"{Fore.WHITE}{Style.BRIGHT}Use '{'sisyphus search --help'}' for assistance{Style.RESET_ALL}") else: if single: - print(f"{sisyphus.getclr.green}{'Package category/name':<45} {'Installed version':<20} {'Latest available version':<30} {'Description'}{sisyphus.getclr.reset}") + print(f"{Fore.GREEN}{'Package category/name':<45} {'Installed version':<20} {'Latest available version':<30} {'Description'}{Style.RESET_ALL}") for pkg in pkglist: if not single: print( - f"{sisyphus.getclr.bright_green}*{sisyphus.getclr.reset}{sisyphus.getclr.bright_white} {pkg['cat']}/{pkg['pn']}{sisyphus.getclr.reset}") + f"{Fore.GREEN}{Style.BRIGHT}*{Style.RESET_ALL}{Fore.WHITE}{Style.BRIGHT} {pkg['cat']}/{pkg['pn']}{Style.RESET_ALL}") print( - f"{sisyphus.getclr.green}\tInstalled version: {sisyphus.getclr.reset}{pkg['iv']}") + f"{Fore.GREEN}\tInstalled version: {Style.RESET_ALL}{pkg['iv']}") if pkg['av'] != 'alien': print( - f"{sisyphus.getclr.green}\tLatest available version: {sisyphus.getclr.reset}{pkg['av']}") + f"{Fore.GREEN}\tLatest available version: {Style.RESET_ALL}{pkg['av']}") else: print( - f"{sisyphus.getclr.green}\tAlien package: {sisyphus.getclr.reset}Use 'sisyphus search --ebuild {pkg['pn']}' for available version!") + f"{Fore.GREEN}\tAlien package: {Style.RESET_ALL}Use 'sisyphus search --ebuild {pkg['pn']}' for available version!") print( - f"{sisyphus.getclr.green}\tDescription: {sisyphus.getclr.reset}{pkg['desc']}\n") + f"{Fore.GREEN}\tDescription: {Style.RESET_ALL}{pkg['desc']}\n") else: cpn = f"{pkg['cat']}/{pkg['pn']}" print( - f"{sisyphus.getclr.bright_white}{cpn:45}{sisyphus.getclr.reset} {str(pkg['iv']):<20} {str(pkg['av']):<30} {str(pkg['desc'])}") + f"{Fore.WHITE}{Style.BRIGHT}{cpn:45}{Style.RESET_ALL} {str(pkg['iv']):<20} {str(pkg['av']):<30} {str(pkg['desc'])}") print(f"\n{len(pkglist)} matching packages have been identified.") def start(filter, cat, pn, desc, single): if sisyphus.checkenv.root(): - print(f"{sisyphus.getclr.bright_red}Searching as root allows database updates. {sisyphus.getclr.reset}\n{sisyphus.getclr.bright_yellow}Search results will be accurate.{sisyphus.getclr.reset}") + print(f"{Fore.RED}{Style.BRIGHT}Searching as root allows database updates. {Style.RESET_ALL}\n{Fore.WHITE}{Style.BRIGHT}Search results would be accurate.{Style.RESET_ALL}") while True: user_input = input( - f"{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}] ") + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if user_input.lower() in ['yes', 'y', '']: sisyphus.syncall.start(gfx_ui=False) break elif user_input.lower() in ['no', 'n']: - print(f"{sisyphus.getclr.bright_red}Skipping database update; displaying search results.{sisyphus.getclr.reset}\n{sisyphus.getclr.bright_yellow}Search results may be inaccurate.{sisyphus.getclr.reset}") + print(f"{Fore.RED}{Style.BRIGHT}Skipping database update; displaying search results.{Style.RESET_ALL}\n{Fore.WHITE}{Style.BRIGHT}Search results may not be accurate.{Style.RESET_ALL}") break else: continue else: - print(f"{sisyphus.getclr.bright_red}Searching as a user does not allow database updates.{sisyphus.getclr.reset}\n{sisyphus.getclr.bright_yellow}Search results may be inaccurate.{sisyphus.getclr.reset}") + print(f"{Fore.RED}{Style.BRIGHT}Searching as user does not allow database updates.{Style.RESET_ALL}\n{Fore.WHITE}{Style.BRIGHT}Search results may not be accurate.{Style.RESET_ALL}") srch_rslt(filter, cat, pn, desc, single) diff --git a/src/backend/setbranch.py b/src/backend/setbranch.py index 8220589..2dd19de 100644 --- a/src/backend/setbranch.py +++ b/src/backend/setbranch.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 import animation +import colorama import git import os import random @@ -8,12 +9,14 @@ import signal import sys import time import sisyphus.checkenv -import sisyphus.getclr import sisyphus.getfs import sisyphus.purgeenv import sisyphus.setjobs import sisyphus.setmirror import sisyphus.setprofile +from colorama import Fore, Back, Style + +colorama.init() brch_rmt_map = { @@ -134,8 +137,10 @@ def set_bhst_index(branch, remote, gfx_ui=False): print(f"\nThe active branch has been switched to '{branch}'") print(f"\nThe active remote has been switched to '{remote}'") else: - print(f"{sisyphus.getclr.green}\nThe active branch has been switched to '{branch}'{sisyphus.getclr.reset}") - print(f"{sisyphus.getclr.green}\nThe active remote has been switched to '{remote}'{sisyphus.getclr.reset}") + print( + f"{Fore.GREEN}\nThe active branch has been switched to '{branch}'{Style.RESET_ALL}") + print( + f"{Fore.GREEN}\nThe active remote has been switched to '{remote}'{Style.RESET_ALL}") if "master" in branch: set_brch_master_index() @@ -156,7 +161,7 @@ def start(branch, remote, gfx_ui=False): os.kill(os.getpid(), signal.SIGTERM) # kill GUI window else: print( - f"{sisyphus.getclr.bright_red}\nNo internet connection detected; Aborting!\n{sisyphus.getclr.reset}") + f"{Fore.RED}{Style.BRIGHT}\nNo internet connection detected; Aborting!\n{Style.RESET_ALL}") sys.exit() else: if gfx_ui: diff --git a/src/backend/syncall.py b/src/backend/syncall.py index ac53d13..b7243f5 100644 --- a/src/backend/syncall.py +++ b/src/backend/syncall.py @@ -1,15 +1,18 @@ #!/usr/bin/python3 import animation +import colorama import os import signal import sys import time import sisyphus.checkenv -import sisyphus.getclr import sisyphus.getenv import sisyphus.syncdb import sisyphus.syncenv +from colorama import Fore, Back, Style + +colorama.init() def sigint_handler(signal, frame): @@ -44,7 +47,7 @@ def start(gfx_ui=False): os.kill(os.getpid(), signal.SIGTERM) # kill GUI window else: print( - f"{sisyphus.getclr.bright_red}\nNo internet connection detected; Aborting!\n{sisyphus.getclr.reset}") + f"{Fore.RED}{Style.BRIGHT}\nNo internet connection detected; Aborting!\n{Style.RESET_ALL}") sys.exit() else: if is_sane == 1: @@ -54,10 +57,10 @@ def start(gfx_ui=False): else: if unread_count > 0: print( - f"\n\nThere are {sisyphus.getclr.bright_red}{unread_count}{sisyphus.getclr.reset} unread news article(s).") + f"\n\nThere are {Fore.RED}{Style.BRIGHT}{unread_count}{Style.RESET_ALL} unread news article(s).") else: print( - f"\n\nThere are {sisyphus.getclr.green}{unread_count}{sisyphus.getclr.reset} unread news article(s).") + f"\n\nThere are {Fore.GREEN}{unread_count}{Style.RESET_ALL} unread news article(s).") else: if gfx_ui: if "packages-next" in bhst_addr: @@ -79,17 +82,17 @@ def start(gfx_ui=False): else: if "packages-next" in bhst_addr: print( - f"{sisyphus.getclr.green}\n\nThe active branch is '{actv_brch}' (stable){sisyphus.getclr.reset}") + f"{Fore.GREEN}\n\nThe active branch is '{actv_brch}' (stable){Style.RESET_ALL}") print( - f"{sisyphus.getclr.green}The active binhost is '{bhst_addr}' (testing){sisyphus.getclr.reset}") + f"{Fore.GREEN}The active binhost is '{bhst_addr}' (testing){Style.RESET_ALL}") else: print( - f"{sisyphus.getclr.green}\n\nThe active branch is '{actv_brch}' (testing){sisyphus.getclr.reset}") + f"{Fore.GREEN}\n\nThe active branch is '{actv_brch}' (testing){Style.RESET_ALL}") print( - f"{sisyphus.getclr.green}The active binhost is '{bhst_addr}' (stable){sisyphus.getclr.reset}") + f"{Fore.GREEN}The active binhost is '{bhst_addr}' (stable){Style.RESET_ALL}") print( - f"{sisyphus.getclr.bright_red}\nInvalid configuration!{sisyphus.getclr.reset}") + f"{Fore.RED}{Style.BRIGHT}\nInvalid configuration!{Style.RESET_ALL}") print( - f"{sisyphus.getclr.bright_yellow}\nUse{sisyphus.getclr.reset} 'sisyphus branch --help' for assistance; Aborting.\n") + f"{FORE.WHITE}{Style.BRIGHT}\nUse 'sisyphus branch --help' for assistance; Aborting.{Style.RESET_ALL}\n") sys.exit() diff --git a/src/backend/sysclean.py b/src/backend/sysclean.py index 77fa370..fc512ae 100644 --- a/src/backend/sysclean.py +++ b/src/backend/sysclean.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 import atexit +import colorama import fcntl import io import os @@ -10,10 +11,12 @@ import selectors import subprocess import sys import sisyphus.checkenv -import sisyphus.getclr import sisyphus.revdepsolve import sisyphus.syncdb import sisyphus.watchdog +from colorama import Fore, Back, Style + +colorama.init() def set_nonblocking(fd): @@ -47,7 +50,7 @@ def start(depclean=False, gfx_ui=False): args = ['--quiet', '--depclean'] if not sisyphus.checkenv.root() and depclean: - print(f"{sisyphus.getclr.bright_red}\nRoot permissions are required to perform this action.\n{sisyphus.getclr.reset}") + print(f"{Fore.RED}{Style.BRIGHT}\nRoot permissions are required to perform this action.\n{Style.RESET_ALL}") sys.exit() else: if gfx_ui: @@ -58,59 +61,68 @@ def start(depclean=False, gfx_ui=False): is_installed, is_needed, is_vague, rm_list = pickle.load( open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgrevdeps.pickle"), "rb")) - if gfx_ui: - p_exe = subprocess.Popen( - ['emerge'] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # kill portage if the program dies or it's terminated by the user - atexit.register(sisyphus.watchdog.start, p_exe) + if len(rm_list) == 0: + if gfx_ui: + print("\nThe system is clean; no orphaned packages found.\n") + else: + print( + f"{Fore.GREEN}{Style.BRIGHT}\nThe system is clean; no orphaned packages found.\n{Style.RESET_ALL}") + sys.exit() + + else: + if gfx_ui: + p_exe = subprocess.Popen( + ['emerge'] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # kill portage if the program dies or it's terminated by the user + atexit.register(sisyphus.watchdog.start, p_exe) - for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): - print(p_out.rstrip()) + for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): + print(p_out.rstrip()) - p_exe.wait() - sisyphus.syncdb.lcl_tbl() + p_exe.wait() + sisyphus.syncdb.lcl_tbl() - else: - print(f"\n{sisyphus.getclr.green}These are the orphaned packages that would be{sisyphus.getclr.reset} 'safely' {sisyphus.getclr.green}unmerged, in order:{sisyphus.getclr.reset}\n") - print( - f"\n{sisyphus.getclr.magenta}{', '.join(rm_list)}{sisyphus.getclr.reset}\n") - print( - f"\n{sisyphus.getclr.bright_white}Total: {len(rm_list)} orphaned package(s){sisyphus.getclr.reset}\n") - - while True: - user_input = input( - f"{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'] + args) - try: - set_nonblocking(sys.stdout.fileno()) - spinner_animation() - - sel = selectors.DefaultSelector() - sel.register(sys.stdin, selectors.EVENT_READ) - - while True: - events = sel.select(timeout=0.1) - for key, mask in events: - if key.fileobj == sys.stdin: - line = sys.stdin.readline().strip() - if line.lower() == 'q': - sys.exit() - if p_exe.poll() is not None: - break - except KeyboardInterrupt: - p_exe.terminate() + else: + print(f"\n{Fore.GREEN}These are the orphaned packages that would be{Style.RESET_ALL} 'safely' {Fore.GREEN}unmerged, in order:{Style.RESET_ALL}\n") + print( + f"\n{Fore.MAGENTA}{', '.join(rm_list)}{Style.RESET_ALL}\n") + print( + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(rm_list)} orphaned package(s){Style.RESET_ALL}\n") + + while True: + user_input = input( + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") + if user_input.lower() in ['yes', 'y', '']: + p_exe = subprocess.Popen(['emerge'] + args) try: - p_exe.wait(1) - except subprocess.TimeoutExpired: - p_exe.kill() - sys.exit() - finally: - p_exe.wait() - sisyphus.syncdb.lcl_tbl() - break - elif user_input.lower() in ['no', 'n']: - break - else: - print( - f"\nApologies, the response '{user_input}' was not recognized.\n") + set_nonblocking(sys.stdout.fileno()) + spinner_animation() + + sel = selectors.DefaultSelector() + sel.register(sys.stdin, selectors.EVENT_READ) + + while True: + events = sel.select(timeout=0.1) + for key, mask in events: + if key.fileobj == sys.stdin: + line = sys.stdin.readline().strip() + if line.lower() == 'q': + sys.exit() + if p_exe.poll() is not None: + break + except KeyboardInterrupt: + p_exe.terminate() + try: + p_exe.wait(1) + except subprocess.TimeoutExpired: + p_exe.kill() + sys.exit() + finally: + p_exe.wait() + sisyphus.syncdb.lcl_tbl() + break + elif user_input.lower() in ['no', 'n']: + break + else: + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") diff --git a/src/backend/sysupgrade.py b/src/backend/sysupgrade.py index 32476c8..6c1beaa 100644 --- a/src/backend/sysupgrade.py +++ b/src/backend/sysupgrade.py @@ -1,6 +1,7 @@ #!/usr/bin/python3 import atexit +import colorama import fcntl import io import os @@ -13,11 +14,13 @@ import time import sisyphus.checkenv import sisyphus.depsolve import sisyphus.dlbinpkg -import sisyphus.getclr import sisyphus.getfs import sisyphus.syncdb import sisyphus.syncall import sisyphus.watchdog +from colorama import Fore, Back, Style + +colorama.init() def set_nonblocking(fd): @@ -51,9 +54,9 @@ def start(ebuild=False, gfx_ui=False): go_args = ['--quiet', '--verbose', '--update', '--deep', '--newuse', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] nogo_args = ['--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', - '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n',] + '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n',] if not sisyphus.checkenv.root(): - print(f"{sisyphus.getclr.bright_red}\nRoot permissions are required for this operation.\n{sisyphus.getclr.reset}") + print(f"{Fore.RED}{Style.BRIGHT}\nRoot permissions are required for this operation.\n{Style.RESET_ALL}") sys.exit() else: if gfx_ui: @@ -84,7 +87,7 @@ def start(ebuild=False, gfx_ui=False): os.kill(os.getpid(), signal.SIGTERM) # kill GUI window else: - print(f"{sisyphus.getclr.bright_red}\nCannot proceed!\n{sisyphus.getclr.reset}{sisyphus.getclr.bright_yellow}Please apply the above changes to your portage configuration files and try again!{sisyphus.getclr.reset}") + print(f"{Fore.RED}{Style.BRIGHT}\nCannot proceed!\n{Style.RESET_ALL}{Fore.WHITE}{Style.BRIGHT}Please apply the above changes to your portage configuration files and try again!{Style.RESET_ALL}") sys.exit() else: if len(bin_list) == 0 and len(src_list) == 0: @@ -92,20 +95,20 @@ def start(ebuild=False, gfx_ui=False): print("\nThe system is up to date; no package upgrades are required.\n") else: print( - f"{sisyphus.getclr.bright_red}\nThe system is up to date; no package upgrades are required.\n{sisyphus.getclr.reset}") + f"{Fore.GREEN}{Style.BRIGHT}\nThe system is up to date; no package upgrades are required.\n{Style.RESET_ALL}") sys.exit() if ebuild: # ebuild mode if len(bin_list) == 0 and len(src_list) != 0: # source mode, ignore aliens print( - f"\n{sisyphus.getclr.green}These are the source packages that would be merged, in order:{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}These are the source packages that would be merged, in order:{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.green}{', '.join(src_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}{', '.join(src_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(src_list)} source package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(src_list)} source package(s){Style.RESET_ALL}\n") while True: user_input = input( - f"{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}] ") + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if user_input.lower() in ['yes', 'y', '']: p_exe = subprocess.Popen( ['emerge'] + go_args + ['@world']) @@ -144,21 +147,21 @@ def start(ebuild=False, gfx_ui=False): continue elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens print( - f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}These are the binary packages that would be merged, in order:{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.MAGENTA}{', '.join(bin_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(bin_list)} binary package(s){Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.green}These are the source packages that would be merged, in order:{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}These are the source packages that would be merged, in order:{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.green}{', '.join(src_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}{', '.join(src_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(src_list)} source package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(src_list)} source package(s){Style.RESET_ALL}\n") while True: user_input = input( - f"{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}] ") + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlbinpkg.start(dl_world=True, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -199,14 +202,14 @@ def start(ebuild=False, gfx_ui=False): continue elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback print( - f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}These are the binary packages that would be merged, in order:{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.MAGENTA}{', '.join(bin_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(bin_list)} binary package(s){Style.RESET_ALL}\n") while True: user_input = input( - f"{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}] ") + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlbinpkg.start(dl_world=True, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -259,9 +262,9 @@ def start(ebuild=False, gfx_ui=False): os.kill(os.getpid(), signal.SIGTERM) # kill GUI window else: print( - f"{sisyphus.getclr.bright_red}\nSource package(s) found in the mix!{sisyphus.getclr.reset}") + f"{Fore.RED}{Style.BRIGHT}\nSource package(s) found in the mix!{Style.RESET_ALL}") print( - f"{sisyphus.getclr.bright_yellow}Use{sisyphus.getclr.reset} 'sisyphus upgrade --ebuild' to perform the upgrade; Aborting.") + f"{Fore.WHITE}{Style.BRIGHT}Use 'sisyphus upgrade --ebuild' to perform the upgrade; Aborting.{Style.RESET_ALL}") sys.exit() elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode (noop), catch aliens if gfx_ui: @@ -276,9 +279,9 @@ def start(ebuild=False, gfx_ui=False): os.kill(os.getpid(), signal.SIGTERM) # kill GUI window else: print( - f"{sisyphus.getclr.bright_red}\nSource package(s) found in the mix!{sisyphus.getclr.reset}") + f"{Fore.RED}{Style.BRIGHT}\nSource package(s) found in the mix!{Style.RESET_ALL}") print( - f"{sisyphus.getclr.bright_yellow}Use{sisyphus.getclr.reset} 'sisyphus upgrade --ebuild' to perform the upgrade; Aborting.") + f"{Fore.WHITE}{Style.BRIGHT}Use 'sisyphus upgrade --ebuild' to perform the upgrade; Aborting.{Style.RESET_ALL}") sys.exit() elif len(bin_list) != 0 and len(src_list) == 0: # binary mode if gfx_ui: @@ -300,14 +303,14 @@ def start(ebuild=False, gfx_ui=False): sisyphus.syncdb.lcl_tbl() else: print( - f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + f"\n{Fore.GREEN}These are the binary packages that would be merged, in order:{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + f"\n{Fore.MAGENTA}{', '.join(bin_list)}{Style.RESET_ALL}\n") print( - f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") + f"\n{Fore.WHITE}{Style.BRIGHT}Total: {len(bin_list)} binary package(s){Style.RESET_ALL}\n") while True: user_input = input( - f"{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}] ") + f"{Fore.WHITE}{Style.BRIGHT}Would you like to proceed?{Style.RESET_ALL} [{Fore.GREEN}{Style.BRIGHT}Yes{Style.RESET_ALL}/{Fore.RED}{Style.BRIGHT}No{Style.RESET_ALL}] ") if user_input.lower() in ['yes', 'y', '']: sisyphus.dlbinpkg.start( dl_world=True, gfx_ui=False) |