summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-04-15 13:40:05 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-04-15 13:40:05 +0100
commit47acd0b822261b6b934f47b89b2276a686cc1865 (patch)
treee9e8088518f5ae5f7cc7e355927da2ce550220d9 /src
parentbec61c175f88026ff9f45abcb0c66194132b8f5f (diff)
backend : improve the countdown timer, use it to kill the GUI whenever an unsupported operation is requested
Diffstat (limited to 'src')
-rw-r--r--src/backend/install.py32
-rw-r--r--src/backend/update.py27
-rw-r--r--src/backend/upgrade.py32
3 files changed, 58 insertions, 33 deletions
diff --git a/src/backend/install.py b/src/backend/install.py
index 8ca3a45..aaab797 100644
--- a/src/backend/install.py
+++ b/src/backend/install.py
@@ -39,7 +39,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False):
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: # catch aliens
+ if need_cfg != 0: # catch aliens
p_exe = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries',
'--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname))
try:
@@ -55,6 +55,12 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False):
print("\nCannot proceed!\n")
print(
"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.getcolor.bright_red +
"\nCannot proceed!\n" + sisyphus.getcolor.reset)
@@ -68,7 +74,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False):
sys.exit()
if ebuild: # ebuild mode
- if len(bin_list) == 0 and len(src_list) != 0: # source only, ignore aliens
+ if len(bin_list) == 0 and len(src_list) != 0: # source mode, ignore aliens
print("\n" + sisyphus.getcolor.green + "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.green + ", ".join(
src_list) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(src_list)) + " " + "source package(s)" + sisyphus.getcolor.reset + "\n")
while True:
@@ -94,7 +100,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False):
print("\nSorry, response" + " " + "'" +
user_input + "'" + " " + "not understood.\n")
continue
- elif len(bin_list) != 0 and len(src_list) != 0: # binary and source, ignore aliens
+ elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens
print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
bin_list) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
print("\n" + sisyphus.getcolor.green + "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.green + ", ".join(
@@ -124,7 +130,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False):
print("\nSorry, response" + " " + "'" +
user_input + "'" + " " + "not understood.\n")
continue
- elif len(bin_list) != 0 and len(src_list) == 0: # binary only, fallback
+ elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback
print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
bin_list) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
while True:
@@ -153,29 +159,41 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False):
user_input + "'" + " " + "not understood.\n")
continue
else: # non-ebuild mode
- if len(bin_list) == 0 and len(src_list) != 0: # source only (noop), catch aliens
+ 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" + "'")
+
+ 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.getcolor.bright_red +
"\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset)
print(sisyphus.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " +
"'" + "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'")
sys.exit()
- elif len(bin_list) != 0 and len(src_list) != 0: # binary and source (noop), catch aliens
+ 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" + "'")
+
+ 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.getcolor.bright_red +
"\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset)
print(sisyphus.getcolor.bright_yellow + "Use" + sisyphus.getcolor.reset + " " +
"'" + "sisyphus install" + " " + " ".join(pkgname) + " " + "--ebuild" + "'")
sys.exit()
- elif len(bin_list) != 0 and len(src_list) == 0: # binary only
+ 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\n" + ", ".join(
bin_list) + "\n\n" + "Total:" + " " + str(len(bin_list)) + " " + "binary package(s)" + "\n\n")
diff --git a/src/backend/update.py b/src/backend/update.py
index 0954334..f369c97 100644
--- a/src/backend/update.py
+++ b/src/backend/update.py
@@ -35,20 +35,15 @@ def start(gfx_ui=False):
if is_online != 1:
if gfx_ui:
- print("\nNo internet connection; Aborting!\n")
- t = 10
- while t > 0:
- mins, secs = divmod(t, 60)
- timer = '{:02d}:{:02d}'.format(mins, secs)
- print(timer, end='\r')
+ print("\n\nNo internet connection; Aborting!\n")
+ for i in range(9, 0, -1):
+ print(f"Killing application in : {i} seconds!")
time.sleep(1)
- t -= 1
- print("Time is up!")
- sys.exit()
+ sys.exit(app.exec_()) # kill GUI window
else:
print(sisyphus.getcolor.bright_red +
- "\nNo internet connection; Aborting!\n" + sisyphus.getcolor.reset)
+ "\n\nNo internet connection; Aborting!\n" + sisyphus.getcolor.reset)
sys.exit()
else:
if is_sane == 1:
@@ -64,17 +59,11 @@ def start(gfx_ui=False):
if gfx_ui:
print("\n\nInvalid configuration!")
print("Use 'sisyphus branch --help' for help\n")
- t = 10
- while t > 0:
- mins, secs = divmod(t, 60)
- timer = '{:02d}:{:02d}'.format(mins, secs)
- print(timer, end='\r')
+ for i in range(9, 0, -1):
+ print(f"Killing application in : {i} seconds!")
time.sleep(1)
- t -= 1
-
- print("Time is up!")
- sys.exit()
+ sys.exit(app.exec_()) # kill GUI window
else:
print(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)
diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py
index 3f25ee7..8de534a 100644
--- a/src/backend/upgrade.py
+++ b/src/backend/upgrade.py
@@ -39,7 +39,7 @@ def start(ebuild=False, gfx_ui=False):
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: # catch aliens
+ if need_cfg != 0: # catch aliens
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'])
try:
@@ -55,6 +55,12 @@ def start(ebuild=False, gfx_ui=False):
print("\nCannot proceed!\n")
print(
"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.getcolor.bright_red +
"\nCannot proceed!\n" + sisyphus.getcolor.reset)
@@ -71,7 +77,7 @@ def start(ebuild=False, gfx_ui=False):
sys.exit()
if ebuild: # ebuild mode
- if len(bin_list) == 0 and len(src_list) != 0: # source only, ignore aliens
+ if len(bin_list) == 0 and len(src_list) != 0: # source mode, ignore aliens
print("\n" + sisyphus.getcolor.green + "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.green + ", ".join(
src_list) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(src_list)) + " " + "source package(s)" + sisyphus.getcolor.reset + "\n")
while True:
@@ -97,7 +103,7 @@ def start(ebuild=False, gfx_ui=False):
print("\nSorry, response" + " " + "'" +
user_input + "'" + " " + "not understood.\n")
continue
- elif len(bin_list) != 0 and len(src_list) != 0: # binary and source, ignore aliens
+ elif len(bin_list) != 0 and len(src_list) != 0: # hybrid mode, ignore aliens
print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
bin_list) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
print("\n" + sisyphus.getcolor.green + "These are the source packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.green + ", ".join(
@@ -127,7 +133,7 @@ def start(ebuild=False, gfx_ui=False):
print("\nSorry, response" + " " + "'" +
user_input + "'" + " " + "not understood.\n")
continue
- elif len(bin_list) != 0 and len(src_list) == 0: # binary only, fallback
+ elif len(bin_list) != 0 and len(src_list) == 0: # binary mode, fallback
print("\n" + sisyphus.getcolor.green + "These are the binary packages that would be merged, in order:" + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.magenta + ", ".join(
bin_list) + sisyphus.getcolor.reset + "\n\n" + sisyphus.getcolor.bright_white + "Total:" + " " + str(len(bin_list)) + " " + "binary package(s)" + sisyphus.getcolor.reset + "\n")
while True:
@@ -156,29 +162,41 @@ def start(ebuild=False, gfx_ui=False):
user_input + "'" + " " + "not understood.\n")
continue
else: # non-ebuild mode
- if len(bin_list) == 0 and len(src_list) != 0: # source only (noop), catch aliens
+ 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.")
+
+ 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.getcolor.bright_red +
"\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset)
print(sisyphus.getcolor.bright_yellow + "Use" +
sisyphus.getcolor.reset + " " + "'" + "sisyphus upgrade --ebuild" + "'")
sys.exit()
- elif len(bin_list) != 0 and len(src_list) != 0: # binary and source (noop), catch aliens
+ 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.")
+
+ 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.getcolor.bright_red +
"\nSource package(s) found in the mix!\n" + sisyphus.getcolor.reset)
print(sisyphus.getcolor.bright_yellow + "Use" +
sisyphus.getcolor.reset + " " + "'" + "sisyphus upgrade --ebuild" + "'")
sys.exit()
- elif len(bin_list) != 0 and len(src_list) == 0: # binary only
+ 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\n" + ", ".join(
bin_list) + "\n\n" + "Total:" + " " + str(len(bin_list)) + " " + "binary package(s)" + "\n\n")