From d81c5e5ffd727a4a0e00910b93eb17737d8f8193 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 1 Mar 2024 11:37:04 +0000 Subject: rewrite the print statements in a more concise and professional way --- src/backend/autormpkgsrc.py | 14 ++--- src/backend/instpkgsrc.py | 142 ++++++++++++++++++++----------------------- src/backend/rmpkgsrc.py | 43 ++++++------- src/backend/searchdb.py | 63 ++++++++----------- src/backend/setbranch.py | 19 +++--- src/backend/setmirror.py | 2 +- src/backend/syncall.py | 49 +++++++-------- src/backend/sysupgrade.py | 143 +++++++++++++++++++++----------------------- 8 files changed, 213 insertions(+), 262 deletions(-) (limited to 'src') diff --git a/src/backend/autormpkgsrc.py b/src/backend/autormpkgsrc.py index d696757..1036f66 100644 --- a/src/backend/autormpkgsrc.py +++ b/src/backend/autormpkgsrc.py @@ -45,11 +45,10 @@ def start(gfx_ui=False): args = ['--quiet', '--depclean'] if sisyphus.checkenv.root() and not gfx_ui: - print("\n" + sisyphus.getclr.bright_white + "Orphaned, no longer needed packages are slated for" + sisyphus.getclr.reset + " " + - sisyphus.getclr.green + "'safe'" + sisyphus.getclr.reset + " " + sisyphus.getclr.bright_white + "removal." + sisyphus.getclr.reset + "\n") + print(f"\n{sisyphus.getclr.bright_white}Packages identified as orphaned and no longer needed are slated for{sisyphus.getclr.reset} {sisyphus.getclr.green}'safe'{sisyphus.getclr.reset} {sisyphus.getclr.bright_white}removal.{sisyphus.getclr.reset}\n") while True: - 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 + "]" + " ") + 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: @@ -82,8 +81,8 @@ def start(gfx_ui=False): elif user_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") continue elif gfx_ui: p_exe = subprocess.Popen( @@ -97,6 +96,5 @@ def start(gfx_ui=False): p_exe.wait() sisyphus.syncdb.lcl_tbl() else: - print(sisyphus.getclr.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) + print(f"{sisyphus.getclr.bright_red}\nRoot permissions are required for this operation.\n{sisyphus.getclr.reset}") sys.exit() diff --git a/src/backend/instpkgsrc.py b/src/backend/instpkgsrc.py index 26e5132..68f10b3 100644 --- a/src/backend/instpkgsrc.py +++ b/src/backend/instpkgsrc.py @@ -49,8 +49,7 @@ signal.signal(signal.SIGINT, sigint_handler) def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): if not sisyphus.checkenv.root(): - print(sisyphus.getclr.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) + print(f"{sisyphus.getclr.bright_red}\nRoot permissions are required for this operation.\n{sisyphus.getclr.reset}") sys.exit() else: if gfx_ui: @@ -92,38 +91,29 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): p_exe.kill() sys.exit() if gfx_ui: - print("\nCannot proceed!\n") - print( - "Apply the above changes to your portage configuration files and try again!") - + print("\nCannot proceed!\nPlease apply the above changes to your portage configuration files and try again.") for i in range(9, 0, -1): print(f"Killing application in : {i} seconds!") time.sleep(1) sys.exit(app.exec_()) # kill GUI window else: - 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) + 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}") sys.exit() else: if len(bin_list) == 0 and len(src_list) == 0: - print(sisyphus.getclr.bright_red + - "\nNo package found!\n" + sisyphus.getclr.reset) - sys.exit() - + print(f"{sisyphus.getclr.bright_red}\nOne or more of the selected packages cannot be located for installation.\n{sisyphus.getclr.reset}") if ebuild: # ebuild mode if len(bin_list) == 0 and len(src_list) != 0: # source mode, ignore aliens - 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") + print( + f"\n{sisyphus.getclr.green}These are the source packages that would be merged, in order:{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.green}{', '.join(src_list)}{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.bright_white}Total: {len(src_list)} source package(s){sisyphus.getclr.reset}\n") while True: - 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 + "]" + " ") + 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', '--quiet', '--verbose', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname)) @@ -157,26 +147,26 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): elif user_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") continue elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens - 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.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") + print( + f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") + + print( + f"\n{sisyphus.getclr.green}These are the source packages that would be merged, in order:{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.green}{', '.join(src_list)}{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.bright_white}Total: {len(src_list)} source package(s){sisyphus.getclr.reset}\n") while True: - 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 + "]" + " ") + 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', '']: sisyphus.dlbinpkg.start(dl_world=False, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -212,19 +202,19 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): elif user_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") continue elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback - 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( + f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") while True: - 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 + "]" + " ") + 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', '']: sisyphus.dlbinpkg.start(dl_world=False, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -260,15 +250,15 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): elif user_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") continue else: # non-ebuild mode if len(bin_list) == 0 and len(src_list) != 0: # source mode (noop), catch aliens if gfx_ui: print("\nSource package(s) found in the mix!\n") - print("Use sisyphus CLI:" + " " + "'" + "sisyphus install" + - " " + " ".join(pkgname) + "--ebuild" + "'") + print( + f"Use the Sisyphus CLI command: 'sisyphus install {' '.join(pkgname)} --ebuild' to perform the install; Aborting.") for i in range(9, 0, -1): print(f"Killing application in : {i} seconds!") @@ -276,16 +266,15 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): sys.exit(app.exec_()) # kill GUI window else: - 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" + "'") + 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.") sys.exit() elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode (noop), catch aliens if gfx_ui: print("\nSource package(s) found in the mix!\n") - print("Use sisyphus CLI:" + " " + "'" + "sisyphus install" + - " " + " ".join(pkgname) + "--ebuild" + "'") + print( + f"Use the Sisyphus CLI command:: 'sisyphus install {' '.join(pkgname)} --ebuild' to perform the install; Aborting.") for i in range(9, 0, -1): print(f"Killing application in : {i} seconds!") @@ -293,17 +282,16 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): sys.exit(app.exec_()) # kill GUI window else: - 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() + 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.") + sys.exit() elif len(bin_list) != 0 and len(src_list) == 0: # binary mode if gfx_ui: print( - "\n" + "These are the binary packages that will be merged, in order:" + "\n") - print("\n" + ", ".join(bin_list) + "\n\n" + "Total:" + " " + - str(len(bin_list)) + " " + "binary package(s)" + "\n\n") + "\nThese are the binary packages that will be merged, in order:\n") + print(", ".join(bin_list) + "\n\nTotal: " + + str(len(bin_list)) + " binary package(s)\n\n") sisyphus.dlbinpkg.start(dl_world=False, gfx_ui=True) os.chdir(sisyphus.getfs.p_cch_dir) p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--with-bdeps=y', @@ -317,15 +305,15 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): p_exe.wait() sisyphus.syncdb.lcl_tbl() else: - 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( + f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") while True: - 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 + "]" + " ") + 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', '']: sisyphus.dlbinpkg.start( dl_world=False, gfx_ui=False) @@ -362,6 +350,6 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False): elif user_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") continue diff --git a/src/backend/rmpkgsrc.py b/src/backend/rmpkgsrc.py index 63343fc..ec5a097 100644 --- a/src/backend/rmpkgsrc.py +++ b/src/backend/rmpkgsrc.py @@ -48,8 +48,7 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): args = ['--quiet', '--depclean'] if not sisyphus.checkenv.root() and (unmerge or depclean): - print(sisyphus.getclr.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) + print(f"{sisyphus.getclr.bright_red}\nRoot permissions are required to perform this action.\n{sisyphus.getclr.reset}") sys.exit() else: if gfx_ui: @@ -139,27 +138,22 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): sys.exit() finally: p_exe.wait() - print(sisyphus.getclr.bright_red + - "\nUnable to proceed! There are other packages with dependencies that prevent removal." + sisyphus.getclr.reset) - print(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!\n" + sisyphus.getclr.reset) - + 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") else: if is_installed == 0: - print(sisyphus.getclr.bright_red + - "\nUnable to proceed! One or more selected packages could not be located for removal.\n" + sisyphus.getclr.reset) + print(f"{sisyphus.getclr.bright_red}\nUnable to proceed! One or more selected packages could not be located for removal.\n{sisyphus.getclr.reset}") sys.exit() else: if unmerge: - print("\n" + sisyphus.getclr.bright_white + "Selected packages are slated for" + sisyphus.getclr.reset + " " + sisyphus.getclr.green + - "'forced'" + sisyphus.getclr.reset + " " + sisyphus.getclr.bright_white + "removal." + sisyphus.getclr.reset + "\n") + print(f"\n{sisyphus.getclr.bright_white}Selected packages are slated for{sisyphus.getclr.reset} {sisyphus.getclr.green}'forced'{sisyphus.getclr.reset} {sisyphus.getclr.bright_white}removal.{sisyphus.getclr.reset}\n") while True: - 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 + "]" + " ") + 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', '']: while True: - confirmation_input = input(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 + "]" + " ") + 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}] ") if confirmation_input.lower() in ['yes', 'y', '']: p_exe = subprocess.Popen( ['emerge', '--quiet', '--unmerge'] + list(pkgname)) @@ -194,15 +188,15 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): elif confirmation_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - confirmation_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{confirmation_input}' was not recognized.\n") continue break elif user_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") continue else: if gfx_ui: @@ -217,11 +211,10 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): p_exe.wait() sisyphus.syncdb.lcl_tbl() else: - print("\n" + sisyphus.getclr.bright_white + "Selected packages are slated for" + sisyphus.getclr.reset + " " + sisyphus.getclr.green + - "'safe'" + sisyphus.getclr.reset + " " + sisyphus.getclr.bright_white + "removal." + sisyphus.getclr.reset + "\n") + print(f"\n{sisyphus.getclr.bright_white}Selected packages are slated for{sisyphus.getclr.reset} {sisyphus.getclr.green}'safe'{sisyphus.getclr.reset} {sisyphus.getclr.bright_white}removal.{sisyphus.getclr.reset}\n") while True: - 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 + "]" + " ") + 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 + list(pkgname)) @@ -255,6 +248,6 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): elif user_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") continue diff --git a/src/backend/searchdb.py b/src/backend/searchdb.py index a99a471..86a5832 100644 --- a/src/backend/searchdb.py +++ b/src/backend/searchdb.py @@ -115,68 +115,55 @@ def tosql(string): def srch_rslt(filter, cat, pn, desc, single): - print("\nSearching" + sisyphus.getclr.bright_yellow + " " + - f"{filter}" + " " + sisyphus.getclr.reset + "packages ..." + "\n") + print( + f"\nSearching {sisyphus.getclr.bright_yellow}{filter}{sisyphus.getclr.reset} packages...\n") pkglist = srch_db(filter, tosql(cat), tosql(pn), tosql(desc)) if len(pkglist) == 0: - 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) + 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}") else: if single: - print(sisyphus.getclr.green + - f"{'Package category/name':45} {'Installed version':20} {'Latest available version':30} {'Description'}" + sisyphus.getclr.reset) + print(f"{sisyphus.getclr.green}{'Package category/name':<45} {'Installed version':<20} {'Latest available version':<30} {'Description'}{sisyphus.getclr.reset}") for pkg in pkglist: if not single: - 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']}") + print( + f"{sisyphus.getclr.bright_green}*{sisyphus.getclr.reset}{sisyphus.getclr.bright_white} {pkg['cat']}/{pkg['pn']}{sisyphus.getclr.reset}") + print( + f"{sisyphus.getclr.green}\tInstalled version: {sisyphus.getclr.reset}{pkg['iv']}") if pkg['av'] != 'alien': - print(sisyphus.getclr.green + "\tLatest available version:" + - " " + sisyphus.getclr.reset + f"{pkg['av']}") + print( + f"{sisyphus.getclr.green}\tLatest available version: {sisyphus.getclr.reset}{pkg['av']}") else: - print(sisyphus.getclr.green + "\tAlien package:" + " " + sisyphus.getclr.reset + - "Use `sisyphus search --ebuild" + " " + f"{pkg['pn']}`" + " " + "for available version!") - print(sisyphus.getclr.green + "\tDescription:" + " " + - sisyphus.getclr.reset + f"{pkg['desc']}" + "\n") + print( + f"{sisyphus.getclr.green}\tAlien package: {sisyphus.getclr.reset}Use 'sisyphus search --ebuild {pkg['pn']}' for available version!") + print( + f"{sisyphus.getclr.green}\tDescription: {sisyphus.getclr.reset}{pkg['desc']}\n") else: cpn = f"{pkg['cat']}/{pkg['pn']}" - 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.getclr.bright_yellow + - f"{len(pkglist)}" + " " + sisyphus.getclr.reset + "matching package(s) ...") + print( + f"{sisyphus.getclr.bright_white}{cpn:45}{sisyphus.getclr.reset} {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(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) + 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}") while True: - 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 + "]" + " ") + 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', '']: sisyphus.syncall.start(gfx_ui=False) break elif user_input.lower() in ['no', 'n']: - 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) + 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}") break else: continue else: - 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) + 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}") srch_rslt(filter, cat, pn, desc, single) diff --git a/src/backend/setbranch.py b/src/backend/setbranch.py index 4763b60..adff88a 100644 --- a/src/backend/setbranch.py +++ b/src/backend/setbranch.py @@ -97,16 +97,12 @@ def set_brch_next_index(): def set_bhst_index(branch, remote): if "master" in branch: - print(sisyphus.getclr.green + "\nActive branch switched:" + - " " + sisyphus.getclr.reset + "'" + branch + "'") - print(sisyphus.getclr.green + "Active remote switched:" + - " " + sisyphus.getclr.reset + "'" + remote + "'") + print(f"{sisyphus.getclr.green}\nThe active branch has been switched to '{branch}'{sisyphus.getclr.reset}") + print(f"{sisyphus.getclr.green}The active remote has been switched to '{remote}'{sisyphus.getclr.reset}") set_brch_master_index() # Set binhost index for branch 'master' (random odd index) elif "next" in branch: - print(sisyphus.getclr.green + "\nActive branch switched:" + - " " + sisyphus.getclr.reset + "'" + branch + "'") - print(sisyphus.getclr.green + "Active remote switched:" + - " " + sisyphus.getclr.reset + "'" + remote + "'") + print(f"{sisyphus.getclr.green}\nThe active branch has been switched to '{branch}'{sisyphus.getclr.reset}") + print(f"{sisyphus.getclr.green}The active remote has been switched to '{remote}'{sisyphus.getclr.reset}") set_brch_next_index() # Set binhost index for branch 'next' (random even index) @@ -124,10 +120,9 @@ def start(branch, remote): sisyphus.setprofile.start() set_bhst_index(branch, remote) else: - print(sisyphus.getclr.bright_red + - "\nNo internet connection; Aborting!\n" + sisyphus.getclr.reset) + print( + f"{sisyphus.getclr.bright_red}\nNo internet connection detected; Aborting!\n{sisyphus.getclr.reset}") sys.exit() else: - print(sisyphus.getclr.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) + print(f"{sisyphus.getclr.bright_red}\nRoot permissions are required to perform this action.\n{sisyphus.getclr.reset}") sys.exit() diff --git a/src/backend/setmirror.py b/src/backend/setmirror.py index 83d83f1..90337cb 100644 --- a/src/backend/setmirror.py +++ b/src/backend/setmirror.py @@ -61,7 +61,7 @@ def writeList(mirrorList): def setActive(mirror): mirrorList = getList() if mirror not in range(1, len(mirrorList) + 1): - print("\n" + "Mirror index is wrong, please check with sisyphus mirror list" + "\n") + print("\nSelected mirror index is incorrect. Please verify using 'sisyphus mirror list'.\n") else: for i in range(0, len(mirrorList)): indx = i + 1 diff --git a/src/backend/syncall.py b/src/backend/syncall.py index d6db8ff..42b0b9c 100644 --- a/src/backend/syncall.py +++ b/src/backend/syncall.py @@ -35,15 +35,15 @@ def start(gfx_ui=False): if is_online != 1: if gfx_ui: - print("\n\nNo internet connection; Aborting!\n") + print("\nNo internet connection detected. Aborting!\n") for i in range(9, 0, -1): print(f"Killing application in : {i} seconds!") time.sleep(1) sys.exit(app.exec_()) # kill GUI window else: - print(sisyphus.getclr.bright_red + - "\n\nNo internet connection; Aborting!\n" + sisyphus.getclr.reset) + print( + f"{sisyphus.getclr.bright_red}\nNo internet connection detected; Aborting!\n{sisyphus.getclr.reset}") sys.exit() else: if is_sane == 1: @@ -51,18 +51,16 @@ def start(gfx_ui=False): else: if gfx_ui: if "packages-next" in bhst_addr: - print("\n\nActive branch:" + " " + "'" + - actv_brch + "'" + " " + "(stable)") - print("\n\nActive binhost:" + " " + "'" + - bhst_addr + "'" + " " + "(testing)") + print(f"\n\nThe active branch is '{actv_brch}' (stable)") + print(f"\n\nThe active binhost is '{bhst_addr}' (testing)") else: - print("\n\nActive branch:" + " " + "'" + - actv_brch + "'" + " " + "(testing)") - print("\n\nActive binhost:" + " " + "'" + - bhst_addr + "'" + " " + "(stable)") + print(f"\n\nThe active branch is '{actv_brch}' (testing)") + print(f"\n\nThe active binhost is '{bhst_addr}' (stable)") + + print("\nInvalid configuration!") + print( + "\nUse the Sisyphus CLI command: 'sisyphus branch --help' for assistance; Aborting.\n") - print("\n\nInvalid configuration!") - print("\nUse 'sisyphus branch --help' for help\n") for i in range(9, 0, -1): print(f"Killing application in : {i} seconds!") time.sleep(1) @@ -70,19 +68,18 @@ def start(gfx_ui=False): sys.exit(app.exec_()) # kill GUI window else: if "packages-next" in bhst_addr: - 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)") + print( + f"{sisyphus.getclr.green}\n\nThe active branch is '{actv_brch}' (stable){sisyphus.getclr.reset}") + print( + f"{sisyphus.getclr.green}The active binhost is '{bhst_addr}' (testing){sisyphus.getclr.reset}") else: - 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( + f"{sisyphus.getclr.green}\n\nThe active branch is '{actv_brch}' (testing){sisyphus.getclr.reset}") + print( + f"{sisyphus.getclr.green}The active binhost is '{bhst_addr}' (stable){sisyphus.getclr.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) + print( + f"{sisyphus.getclr.bright_red}\nInvalid configuration!{sisyphus.getclr.reset}") + print( + f"{sisyphus.getclr.bright_yellow}\nUse{sisyphus.getclr.reset} 'sisyphus branch --help' for assistance; Aborting.\n") sys.exit() diff --git a/src/backend/sysupgrade.py b/src/backend/sysupgrade.py index f85b2a6..f6415f3 100644 --- a/src/backend/sysupgrade.py +++ b/src/backend/sysupgrade.py @@ -49,8 +49,7 @@ signal.signal(signal.SIGINT, sigint_handler) def start(ebuild=False, gfx_ui=False): if not sisyphus.checkenv.root(): - print(sisyphus.getclr.bright_red + - "\nYou need root permissions to do this!\n" + sisyphus.getclr.reset) + print(f"{sisyphus.getclr.bright_red}\nRoot permissions are required for this operation.\n{sisyphus.getclr.reset}") sys.exit() else: if gfx_ui: @@ -75,41 +74,35 @@ def start(ebuild=False, gfx_ui=False): p_exe.kill() sys.exit() if gfx_ui: - print("\nCannot proceed!\n") - print( - "Apply the above changes to your portage configuration files and try again") - + print("\nCannot proceed!\nPlease apply the above changes to your portage configuration files and try again.") for i in range(9, 0, -1): print(f"Killing application in : {i} seconds!") time.sleep(1) sys.exit(app.exec_()) # kill GUI window else: - 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) + 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}") sys.exit() else: if len(bin_list) == 0 and len(src_list) == 0: if gfx_ui: - print("\nNo package upgrades found!\n") + print("\nThe system is up to date; no package upgrades are required.\n") else: - print(sisyphus.getclr.bright_red + - "\nNo package upgrades found!\n" + sisyphus.getclr.reset) + print( + f"{sisyphus.getclr.bright_red}\nThe system is up to date; no package upgrades are required.\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.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") + print( + f"\n{sisyphus.getclr.green}These are the source packages that would be merged, in order:{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.green}{', '.join(src_list)}{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.bright_white}Total: {len(src_list)} source package(s){sisyphus.getclr.reset}\n") while True: - 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 + "]" + " ") + 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', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) @@ -143,26 +136,26 @@ def start(ebuild=False, gfx_ui=False): elif user_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") continue elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens - 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.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") + print( + f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") + + print( + f"\n{sisyphus.getclr.green}These are the source packages that would be merged, in order:{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.green}{', '.join(src_list)}{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.bright_white}Total: {len(src_list)} source package(s){sisyphus.getclr.reset}\n") while True: - 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 + "]" + " ") + 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', '']: sisyphus.dlbinpkg.start(dl_world=True, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -198,19 +191,19 @@ def start(ebuild=False, gfx_ui=False): elif user_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") continue elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback - 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( + f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") while True: - 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 + "]" + " ") + 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', '']: sisyphus.dlbinpkg.start(dl_world=True, gfx_ui=False) os.chdir(sisyphus.getfs.p_cch_dir) @@ -246,15 +239,15 @@ def start(ebuild=False, gfx_ui=False): elif user_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") continue else: # non-ebuild mode if len(bin_list) == 0 and len(src_list) != 0: # source mode (noop), catch aliens if gfx_ui: print("\nSource package(s) found in the mix!\n") - print("Use sisyphus CLI:" + " " + "'" + "sisyphus upgrade --ebuild" + - "'" + " " + "to perform the upgrade;" + " " + "Aborting.") + print( + f"Use the Sisyphus CLI command: 'sisyphus upgrade --ebuild' to perform the upgrade; Aborting.") for i in range(9, 0, -1): print(f"Killing application in : {i} seconds!") @@ -262,16 +255,16 @@ def start(ebuild=False, gfx_ui=False): sys.exit(app.exec_()) # kill GUI window else: - 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" + "'") + print( + f"{sisyphus.getclr.bright_red}\nSource package(s) found in the mix!{sisyphus.getclr.reset}") + print( + f"{sisyphus.getclr.bright_yellow}Use{sisyphus.getclr.reset} 'sisyphus upgrade --ebuild' to perform the upgrade; Aborting.") sys.exit() elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode (noop), catch aliens if gfx_ui: print("\nSource package(s) found in the mix!\n") - print("Use sisyphus CLI:" + " " + "'" + "sisyphus upgrade --ebuild" + - "'" + " " + "to perform the upgrade;" + " " + "Aborting.") + print( + f"Use the Sisyphus CLI command: 'sisyphus upgrade --ebuild' to perform the upgrade; Aborting.") for i in range(9, 0, -1): print(f"Killing application in : {i} seconds!") @@ -279,17 +272,17 @@ def start(ebuild=False, gfx_ui=False): sys.exit(app.exec_()) # kill GUI window else: - 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" + "'") + print( + f"{sisyphus.getclr.bright_red}\nSource package(s) found in the mix!{sisyphus.getclr.reset}") + print( + f"{sisyphus.getclr.bright_yellow}Use{sisyphus.getclr.reset} 'sisyphus upgrade --ebuild' to perform the upgrade; Aborting.") sys.exit() elif len(bin_list) != 0 and len(src_list) == 0: # binary mode if gfx_ui: print( - "\n" + "These are the binary packages that will be merged, in order:" + "\n") - print("\n" + ", ".join(bin_list) + "\n\n" + "Total:" + " " + - str(len(bin_list)) + " " + "binary package(s)" + "\n\n") + f"\nThese are the binary packages that will be merged, in order:\n") + print(", ".join(bin_list) + + f"\n\nTotal: {len(bin_list)} binary package(s)\n") sisyphus.dlbinpkg.start(dl_world=True, gfx_ui=True) os.chdir(sisyphus.getfs.p_cch_dir) p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries', @@ -303,15 +296,15 @@ def start(ebuild=False, gfx_ui=False): p_exe.wait() sisyphus.syncdb.lcl_tbl() else: - 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( + f"\n{sisyphus.getclr.green}These are the binary packages that would be merged, in order:{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.magenta}{', '.join(bin_list)}{sisyphus.getclr.reset}\n") + print( + f"\n{sisyphus.getclr.bright_white}Total: {len(bin_list)} binary package(s){sisyphus.getclr.reset}\n") while True: - 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 + "]" + " ") + 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', '']: sisyphus.dlbinpkg.start( dl_world=True, gfx_ui=False) @@ -348,6 +341,6 @@ def start(ebuild=False, gfx_ui=False): elif user_input.lower() in ['no', 'n']: break else: - print("\nSorry, response" + " " + "'" + - user_input + "'" + " " + "not understood.\n") + print( + f"\nApologies, the response '{user_input}' was not recognized.\n") continue -- cgit v1.2.3