diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-03-11 05:32:19 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-03-11 05:32:19 +0000 |
commit | a9d87ee5bd0c98b6daae9ddf307c634da9c35551 (patch) | |
tree | 3ae25a65b1511d7a9368fa21b4779a6880a132b7 | |
parent | 4edf9a7f554f183ccc34b0e57e734a2cbd6f5b9d (diff) |
run autopep8 on the code
-rw-r--r-- | src/backend/autoremove.py | 7 | ||||
-rw-r--r-- | src/backend/checkenv.py | 10 | ||||
-rw-r--r-- | src/backend/download.py | 36 | ||||
-rw-r--r-- | src/backend/getenv.py | 18 | ||||
-rw-r--r-- | src/backend/install.py | 40 | ||||
-rw-r--r-- | src/backend/search.py | 12 | ||||
-rw-r--r-- | src/backend/setbranch.py | 33 | ||||
-rw-r--r-- | src/backend/solvedeps.py | 6 | ||||
-rw-r--r-- | src/backend/syncenv.py | 12 | ||||
-rw-r--r-- | src/backend/uninstall.py | 4 | ||||
-rw-r--r-- | src/backend/update.py | 38 | ||||
-rw-r--r-- | src/backend/upgrade.py | 34 | ||||
-rw-r--r-- | src/frontend/gui/sisyphus-gui.py | 2 |
13 files changed, 116 insertions, 136 deletions
diff --git a/src/backend/autoremove.py b/src/backend/autoremove.py index 7ea7fb4..642ae40 100644 --- a/src/backend/autoremove.py +++ b/src/backend/autoremove.py @@ -12,8 +12,7 @@ import sisyphus.syncdb def start(): if sisyphus.checkenv.root(): - p_exe = subprocess.Popen( - ['emerge', '--quiet', '--depclean', '--ask']) + p_exe = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask']) p_exe.wait() sisyphus.syncdb.lcl_tbl() else: @@ -23,8 +22,8 @@ def start(): def xstart(): - p_exe = subprocess.Popen( - ['emerge', '--depclean'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p_exe = subprocess.Popen(['emerge', '--depclean'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) # kill portage if the program dies or it's terminated by the user atexit.register(sisyphus.killemerge.start, p_exe) diff --git a/src/backend/checkenv.py b/src/backend/checkenv.py index 6c0be73..c8152bf 100644 --- a/src/backend/checkenv.py +++ b/src/backend/checkenv.py @@ -10,17 +10,17 @@ def root(): def sanity(): - act_brch = sisyphus.getenv.sys_brch() - bh_addr = sisyphus.getenv.bh_addr() + actv_brch = sisyphus.getenv.sys_brch() + bhst_addr = sisyphus.getenv.bhst_addr() is_sane = int() - if "packages-next" in bh_addr: - if act_brch == "next": + if "packages-next" in bhst_addr: + if actv_brch == "next": is_sane = int(1) else: is_sane = int(0) else: - if act_brch == "master": + if actv_brch == "master": is_sane = int(1) else: is_sane = int(0) diff --git a/src/backend/download.py b/src/backend/download.py index 1d78eaf..32e27a6 100644 --- a/src/backend/download.py +++ b/src/backend/download.py @@ -11,40 +11,40 @@ import sisyphus.killemerge def dl_pbin_only(): dl_list = [] - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) for index, pbin in enumerate(['=' + package for package in bin_list]): dl_list.append(pbin) p_exe = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--getbinpkgonly', '--fetchonly', - '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list)) + '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list)) p_exe.wait() def dl_pbin(): dl_list = [] - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) for index, pbin in enumerate(['=' + package for package in bin_list]): dl_list.append(pbin) p_exe = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--fetchonly', - '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list)) + '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list)) p_exe.wait() def xdl_pbin_only(): dl_list = [] - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) for index, pbin in enumerate(['=' + package for package in bin_list]): dl_list.append(pbin) p_exe = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--getbinpkgonly', '--fetchonly', '--rebuilt-binaries', - '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list), stdout=subprocess.PIPE, stderr=subprocess.PIPE) # kill portage if the program dies or it's terminated by the user atexit.register(sisyphus.killemerge.start, p_exe) @@ -56,40 +56,40 @@ def xdl_pbin_only(): def dl_wpbin_only(): dl_list = [] - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) for index, pbin in enumerate(['=' + package for package in bin_list]): dl_list.append(pbin) p_exe = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--getbinpkgonly', '--fetchonly', - '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list)) + '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list)) p_exe.wait() def dl_wpbin(): dl_list = [] - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) for index, pbin in enumerate(['=' + package for package in bin_list]): dl_list.append(pbin) p_exe = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--fetchonly', - '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list)) + '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list)) p_exe.wait() def xdl_wpbin_only(): dl_list = [] - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) for index, pbin in enumerate(['=' + package for package in bin_list]): dl_list.append(pbin) p_exe = subprocess.Popen(['emerge', '--nodeps', '--quiet', '--verbose', '--getbinpkg', '--getbinpkgonly', '--fetchonly', '--rebuilt-binaries', - '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list), stdout=subprocess.PIPE, stderr=subprocess.PIPE) # kill portage if the program dies or it's terminated by the user atexit.register(sisyphus.killemerge.start, p_exe) diff --git a/src/backend/getenv.py b/src/backend/getenv.py index 42429f2..3399288 100644 --- a/src/backend/getenv.py +++ b/src/backend/getenv.py @@ -6,21 +6,21 @@ import subprocess import sisyphus.getfs -def bh_addr(): - bh_addr = [] +def bhst_addr(): + bhst_addr = [] p_exe = subprocess.Popen( ['emerge', '--info', '--verbose'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"): if "PORTAGE_BINHOST" in p_out: - bh_addr = p_out.rstrip().split("=")[1].strip('\"') + bhst_addr = p_out.rstrip().split("=")[1].strip('\"') p_exe.wait() - return bh_addr + return bhst_addr def csv_addr(): - csv_addr = bh_addr() + csv_addr = bhst_addr() pcsv_addr = [] dcsv_addr = [] @@ -39,7 +39,7 @@ def csv_addr(): def sys_brch(): - act_brch = None + actv_brch = None if os.path.isdir(os.path.join(sisyphus.getfs.g_src_dir, '.git')): os.chdir(sisyphus.getfs.g_src_dir) @@ -47,9 +47,9 @@ def sys_brch(): ['git', 'rev-parse', '--abbrev-ref', 'HEAD']) if lcl_brch.decode().strip() == 'master': - act_brch = str('master') + actv_brch = str('master') if lcl_brch.decode().strip() == 'next': - act_brch = str('next') + actv_brch = str('next') - return act_brch + return actv_brch diff --git a/src/backend/install.py b/src/backend/install.py index aa5a8cb..d214ebd 100644 --- a/src/backend/install.py +++ b/src/backend/install.py @@ -20,8 +20,8 @@ def start(pkgname): if sisyphus.checkenv.root(): sisyphus.update.start() sisyphus.solvedeps.pkg(pkgname) - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) if need_cfg == 0: if len(src_list) == 0: @@ -34,14 +34,12 @@ def start(pkgname): "[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: sisyphus.download.dl_pbin_only() - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', - '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname)) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', + '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname)) p_exe.wait() sisyphus.syncdb.lcl_tbl() break elif user_input.lower() in ['no', 'n']: - print(sisyphus.getcolor.bright_green + - "\nOk!\n" + sisyphus.getcolor.reset) break sys.exit() else: @@ -75,8 +73,8 @@ def estart(pkgname): if sisyphus.checkenv.root(): sisyphus.update.start() sisyphus.solvedeps.pkg(pkgname) - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) if need_cfg == 0: if len(src_list) == 0: @@ -89,14 +87,12 @@ def estart(pkgname): "[" + sisyphus.getcolor.bright_green + "Yes" + sisyphus.getcolor.reset + "/" + sisyphus.getcolor.bright_red + "No" + sisyphus.getcolor.reset + "]" + " ") if user_input.lower() in ['yes', 'y', '']: sisyphus.download.dl_pbin_only() - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', - '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname)) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', + '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname)) p_exe.wait() sisyphus.syncdb.lcl_tbl() break elif user_input.lower() in ['no', 'n']: - print(sisyphus.getcolor.bright_green + - "\nOk!\n" + sisyphus.getcolor.reset) break sys.exit() else: @@ -120,13 +116,11 @@ def estart(pkgname): if user_input.lower() in ['yes', 'y', '']: sisyphus.download.dl_pbin() p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--rebuilt-binaries', - '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname)) + '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname)) p_exe.wait() sisyphus.syncdb.lcl_tbl() break elif user_input.lower() in ['no', 'n']: - print(sisyphus.getcolor.bright_green + - "\nOk!\n" + sisyphus.getcolor.reset) break sys.exit() else: @@ -146,8 +140,6 @@ def estart(pkgname): sisyphus.syncdb.lcl_tbl() break elif user_input.lower() in ['no', 'n']: - print(sisyphus.getcolor.bright_green + - "\nOk!\n" + sisyphus.getcolor.reset) break sys.exit() else: @@ -156,7 +148,7 @@ def estart(pkgname): continue else: p_exe = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', - '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname)) + '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname)) p_exe.wait() print(sisyphus.getcolor.bright_red + "\nCannot proceed!\n" + sisyphus.getcolor.reset) @@ -171,15 +163,15 @@ def estart(pkgname): def xstart(pkgname): sisyphus.solvedeps.pkg.__wrapped__(pkgname) # undecorate - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb")) os.chdir(sisyphus.getfs.p_cch_dir) - print("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + ", ".join( - bin_list) + "\n\n" + "Total:" + " " + str(len(bin_list)) + " " + "binary package(s)" + "\n\n") + print("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + + ", ".join(bin_list) + "\n\n" + "Total:" + " " + str(len(bin_list)) + " " + "binary package(s)" + "\n\n") sisyphus.download.xdl_pbin_only() - p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', - '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--with-bdeps=y', + '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # kill portage if the program dies or it's terminated by the user atexit.register(sisyphus.killemerge.start, p_exe) diff --git a/src/backend/search.py b/src/backend/search.py index 564bd38..ab6ffa2 100644 --- a/src/backend/search.py +++ b/src/backend/search.py @@ -8,7 +8,7 @@ import sisyphus.getfs import sisyphus.update -def searchDB(filter, cat='', pn='', desc=''): +def srch_db(filter, cat='', pn='', desc=''): NOVIRT = "AND cat NOT LIKE 'virtual'" SELECTS = { 'all': f'''SELECT @@ -106,18 +106,18 @@ def tosql(string): return '%%' if string == '' else string.replace('*', '%').replace('?', '_') -def showSearch(filter, cat, pn, desc, single): +def srch_rslt(filter, cat, pn, desc, single): print("Searching" + sisyphus.getcolor.bright_yellow + " " + f"{filter}" + " " + sisyphus.getcolor.reset + "packages ..." + "\n") - pkglist = searchDB(filter, tosql(cat), tosql(pn), tosql(desc)) + 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.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " + "'" + + "sisyphus search --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) else: if single: print(sisyphus.getcolor.green + @@ -151,7 +151,7 @@ def start(filter, cat, pn, desc, single): print(sisyphus.getcolor.bright_red + "\nYou don't have root permissions, cannot update the database!\n" + sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow + "\nSearch results may be inaccurate" + sisyphus.getcolor.reset) - showSearch(filter, cat, pn, desc, single) + srch_rslt(filter, cat, pn, desc, single) def estart(pkgname): diff --git a/src/backend/setbranch.py b/src/backend/setbranch.py index c5e419a..5aa6a65 100644 --- a/src/backend/setbranch.py +++ b/src/backend/setbranch.py @@ -40,28 +40,25 @@ def get_brch_rmt(branch, remote): @animation.wait('injecting Gentoo Linux portage tree') def ins_g_repo(branch, remote): - g_rmt, r_rmt, p_cfg_rmt = get_brch_rmt( - branch, remote) + g_rmt, r_rmt, p_cfg_rmt = get_brch_rmt(branch, remote) if not os.path.isdir(os.path.join(sisyphus.getfs.g_src_dir, '.git')): - git.Repo.clone_from("/".join(g_rmt), - sisyphus.getfs.g_src_dir, depth=1, branch=branch) + git.Repo.clone_from( + "/".join(g_rmt), sisyphus.getfs.g_src_dir, depth=1, branch=branch) @animation.wait('injecting Redcore Linux ebuild overlay') def ins_r_repo(branch, remote): - g_rmt, r_rmt, p_cfg_rmt = get_brch_rmt( - branch, remote) + g_rmt, r_rmt, p_cfg_rmt = get_brch_rmt(branch, remote) if not os.path.isdir(os.path.join(sisyphus.getfs.r_src_dir, '.git')): - git.Repo.clone_from("/".join(r_rmt), - sisyphus.getfs.r_src_dir, depth=1, branch=branch) + git.Repo.clone_from( + "/".join(r_rmt), sisyphus.getfs.r_src_dir, depth=1, branch=branch) @animation.wait('injecting Redcore Linux portage config') def ins_p_cfg_repo(branch, remote): - g_rmt, r_rmt, p_cfg_rmt = get_brch_rmt( - branch, remote) + g_rmt, r_rmt, p_cfg_rmt = get_brch_rmt(branch, remote) if not os.path.isdir(os.path.join(sisyphus.getfs.p_cfg_dir, '.git')): git.Repo.clone_from("/".join(p_cfg_rmt), @@ -74,19 +71,19 @@ def brch_s_warn(branch, remote): " " + sisyphus.getcolor.reset + "'" + branch + "'") print(sisyphus.getcolor.green + "Active remote switched:" + " " + sisyphus.getcolor.reset + "'" + remote + "'") - print(sisyphus.getcolor.bright_yellow + "\nUse" + sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 3" + "'" + " " + sisyphus.getcolor.bright_yellow + "or" + - sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 7" + "'" + " " + sisyphus.getcolor.bright_yellow + "to pair the binhost" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + - "Use" + sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) + print(sisyphus.getcolor.bright_yellow + "\nUse" + sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 3" + "'" + " " + sisyphus.getcolor.bright_yellow + + "or" + sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 7" + "'" + " " + sisyphus.getcolor.bright_yellow + "to pair the binhost" + sisyphus.getcolor.reset) + print(sisyphus.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " + "'" + + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) 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.getcolor.bright_yellow + "\nUse" + sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 4" + "'" + " " + sisyphus.getcolor.bright_yellow + "or" + - sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 8" + "'" + " " + sisyphus.getcolor.bright_yellow + "to pair the binhost" + sisyphus.getcolor.reset) - print(sisyphus.getcolor.bright_yellow + - "Use" + sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) + print(sisyphus.getcolor.bright_yellow + "\nUse" + sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 4" + "'" + " " + sisyphus.getcolor.bright_yellow + + "or" + sisyphus.getcolor.reset + " " + "'" + "sisyphus mirror set 8" + "'" + " " + sisyphus.getcolor.bright_yellow + "to pair the binhost" + sisyphus.getcolor.reset) + print(sisyphus.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " + "'" + + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) def start(branch, remote): diff --git a/src/backend/solvedeps.py b/src/backend/solvedeps.py index 4e2f5d5..407f4f4 100644 --- a/src/backend/solvedeps.py +++ b/src/backend/solvedeps.py @@ -13,7 +13,7 @@ def pkg(pkgname): src_list = [] need_cfg = int() p_exe = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--with-bdeps=y', - '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p_exe.communicate() for p_out in stderr.decode('utf-8').splitlines(): @@ -50,8 +50,8 @@ def world(): bin_list = [] src_list = [] need_cfg = int() - p_exe = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', '--rebuilt-binaries', - '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p_exe = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--backtrack=100', + '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p_exe.communicate() for p_out in stderr.decode('utf-8').splitlines(): diff --git a/src/backend/syncenv.py b/src/backend/syncenv.py index e27d9ef..25b418e 100644 --- a/src/backend/syncenv.py +++ b/src/backend/syncenv.py @@ -16,8 +16,8 @@ def g_repo(): lcl_brch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE) g_exe1.wait() - g_exe2 = subprocess.Popen(['git', 'reset', '--hard'] + rmt_brch.decode( - ).strip().replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE) + g_exe2 = subprocess.Popen(['git', 'reset', '--hard'] + rmt_brch.decode().strip( + ).replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE) g_exe2.wait() @@ -32,8 +32,8 @@ def r_repo(): lcl_brch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE) g_exe1.wait() - g_exe2 = subprocess.Popen(['git', 'reset', '--hard'] + rmt_brch.decode( - ).strip().replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE) + g_exe2 = subprocess.Popen(['git', 'reset', '--hard'] + rmt_brch.decode().strip( + ).replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE) g_exe2.wait() @@ -49,8 +49,8 @@ def p_cfg_repo(): g_exe2 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + lcl_brch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE) g_exe2.wait() - g_exe3 = subprocess.Popen(['git', 'reset', '--hard'] + rmt_brch.decode( - ).strip().replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE) + g_exe3 = subprocess.Popen(['git', 'reset', '--hard'] + rmt_brch.decode().strip( + ).replace('refs/remotes/', '').split() + ['--quiet'], stdout=subprocess.PIPE) g_exe3.wait() g_exe4 = subprocess.Popen( ['git', 'stash', 'apply'], stdout=subprocess.PIPE) diff --git a/src/backend/uninstall.py b/src/backend/uninstall.py index 4c54d7b..23cd2c5 100644 --- a/src/backend/uninstall.py +++ b/src/backend/uninstall.py @@ -35,8 +35,8 @@ def fstart(pkgname): def xstart(pkgname): - p_exe = subprocess.Popen( - ['emerge', '--depclean'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p_exe = subprocess.Popen(['emerge', '--depclean'] + pkgname, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) # kill portage if the program dies or it's terminated by the user atexit.register(sisyphus.killemerge.start, p_exe) diff --git a/src/backend/update.py b/src/backend/update.py index 08765a7..dc16d4c 100644 --- a/src/backend/update.py +++ b/src/backend/update.py @@ -11,7 +11,7 @@ import sisyphus.syncdb import sisyphus.syncenv -def syncAll(): +def sync_evrth(): sisyphus.syncenv.g_repo() sisyphus.syncenv.r_repo() sisyphus.syncenv.p_cfg_repo() @@ -20,37 +20,37 @@ def syncAll(): @animation.wait('fetching updates') def start(): - act_brch = sisyphus.getenv.sys_brch() - bh_addr = sisyphus.getenv.bh_addr() + actv_brch = sisyphus.getenv.sys_brch() + bhst_addr = sisyphus.getenv.bhst_addr() is_sane = sisyphus.checkenv.sanity() if is_sane == 1: - syncAll() + sync_evrth() else: - if "packages-next" in bh_addr: - print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + act_brch + "'" + " " + "(stable)" + - " " + sisyphus.getcolor.green + "\nActive binhost:" + " " + sisyphus.getcolor.reset + "'" + bh_addr + "'" + " " + "(testing)") + if "packages-next" in bhst_addr: + print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + actv_brch + "'" + " " + "(stable)" + + " " + sisyphus.getcolor.green + "\nActive binhost:" + " " + sisyphus.getcolor.reset + "'" + bhst_addr + "'" + " " + "(testing)") else: - print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + act_brch + "'" + " " + "(testing)" + - " " + sisyphus.getcolor.green + "\nActive binhost:" + " " + sisyphus.getcolor.reset + "'" + bh_addr + "'" + " " + "(stable)") - sys.exit(sisyphus.getcolor.bright_red + "\n\nInvalid configuration!" + sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow + - "\nUse" + sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) + print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + actv_brch + "'" + " " + "(testing)" + + " " + sisyphus.getcolor.green + "\nActive binhost:" + " " + sisyphus.getcolor.reset + "'" + bhst_addr + "'" + " " + "(stable)") + sys.exit(sisyphus.getcolor.bright_red + "\n\nInvalid configuration!" + sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow + "\nUse" + + sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) def xstart(): - act_brch = sisyphus.getenv.sys_brch() - bh_addr = sisyphus.getenv.bh_addr() + actv_brch = sisyphus.getenv.sys_brch() + bhst_addr = sisyphus.getenv.bhst_addr() is_sane = sisyphus.checkenv.sanity() if is_sane == 1: - syncAll() + sync_evrth() else: - if "packages-next" in bh_addr: - print("\n\nActive branch:" + " " + "'" + act_brch + "'" + " " + "(stable)" + - "\nActive binhost:" + " " + "'" + bh_addr + "'" + " " + "(testing)") + if "packages-next" in bhst_addr: + print("\n\nActive branch:" + " " + "'" + actv_brch + "'" + " " + "(stable)" + + "\nActive binhost:" + " " + "'" + bhst_addr + "'" + " " + "(testing)") else: - print("\n\nActive branch:" + " " + "'" + act_brch + "'" + " " + "(testing)" + - "\nActive binhost:" + " " + "'" + bh_addr + "'" + " " + "(stable)") + print("\n\nActive branch:" + " " + "'" + actv_brch + "'" + " " + "(testing)" + + "\nActive binhost:" + " " + "'" + bhst_addr + "'" + " " + "(stable)") print("\n\nInvalid configuration!" + "\nUse 'sisyphus branch --help' for help\n") t = int(10) diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py index 53b2e80..c138533 100644 --- a/src/backend/upgrade.py +++ b/src/backend/upgrade.py @@ -20,8 +20,8 @@ def start(): if sisyphus.checkenv.root(): sisyphus.update.start() sisyphus.solvedeps.world() - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) if need_cfg == 0: if len(src_list) == 0: @@ -35,13 +35,11 @@ def start(): if user_input.lower() in ['yes', 'y', '']: sisyphus.download.dl_wpbin_only() p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', - '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) + '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) p_exe.wait() sisyphus.syncdb.lcl_tbl() break elif user_input.lower() in ['no', 'n']: - print(sisyphus.getcolor.bright_green + - "\nOk!\n" + sisyphus.getcolor.reset) break sys.exit() else: @@ -75,8 +73,8 @@ def estart(): if sisyphus.checkenv.root(): sisyphus.update.start() sisyphus.solvedeps.world() - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) if need_cfg == 0: if len(src_list) == 0: @@ -90,13 +88,11 @@ def estart(): if user_input.lower() in ['yes', 'y', '']: sisyphus.download.dl_wpbin_only() p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', - '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) + '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) p_exe.wait() sisyphus.syncdb.lcl_tbl() break elif user_input.lower() in ['no', 'n']: - print(sisyphus.getcolor.bright_green + - "\nOk!\n" + sisyphus.getcolor.reset) break sys.exit() else: @@ -120,13 +116,11 @@ def estart(): if user_input.lower() in ['yes', 'y', '']: sisyphus.download.dl_wpbin() p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', - '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) + '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) p_exe.wait() sisyphus.syncdb.lcl_tbl() break elif user_input.lower() in ['no', 'n']: - print(sisyphus.getcolor.bright_green + - "\nOk!\n" + sisyphus.getcolor.reset) break sys.exit() else: @@ -140,14 +134,12 @@ def estart(): 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 + "]" + " ") 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'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--backtrack=100', '--with-bdeps=y', + '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) p_exe.wait() sisyphus.syncdb.lcl_tbl() break elif user_input.lower() in ['no', 'n']: - print(sisyphus.getcolor.bright_green + - "\nOk!\n" + sisyphus.getcolor.reset) break sys.exit() else: @@ -156,7 +148,7 @@ def estart(): continue else: p_exe = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', - '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) + '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']) p_exe.wait() print(sisyphus.getcolor.bright_red + "\nCannot proceed!\n" + sisyphus.getcolor.reset) @@ -171,8 +163,8 @@ def estart(): def xstart(): sisyphus.solvedeps.world.__wrapped__() # undecorate - bin_list, src_list, need_cfg = pickle.load(open(os.path.join( - sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) + bin_list, src_list, need_cfg = pickle.load( + open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb")) if not len(src_list) == 0: print("\n" + "Source package(s) found in the mix;" + " " + "Use sisyphus CLI:" + " " + "'" + @@ -184,7 +176,7 @@ def xstart(): bin_list) + "\n\n" + "Total:" + " " + str(len(bin_list)) + " " + "binary package(s)" + "\n\n") sisyphus.download.xdl_wpbin_only() p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries', - '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) # kill portage if the program dies or it's terminated by the user atexit.register(sisyphus.killemerge.start, p_exe) diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py index 9cad251..a2fa3cd 100644 --- a/src/frontend/gui/sisyphus-gui.py +++ b/src/frontend/gui/sisyphus-gui.py @@ -212,7 +212,7 @@ class Sisyphus(QtWidgets.QMainWindow): AND iv <> av ''' % (Sisyphus.applicationView, Sisyphus.searchTerm, noVirtual)), ]) - with sqlite3.connect(sisyphus.getfs.localDatabase) as db: + with sqlite3.connect(sisyphus.getfs.lcl_db) as db: cursor = db.cursor() cursor.execute('%s' % (self.SELECTS[Sisyphus.databaseView])) rows = cursor.fetchall() |