From 8d345d75ea4a692b3e9f2830465ec6b580eee730 Mon Sep 17 00:00:00 2001
From: V3n3RiX <venerix@koprulu.sector>
Date: Thu, 8 Feb 2024 17:07:24 +0000
Subject: download -> dlpkg

---
 src/backend/__init__.py |  2 +-
 src/backend/dlpkg.py    | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/backend/download.py | 59 -------------------------------------------------
 src/backend/install.py  | 10 ++++-----
 src/backend/upgrade.py  | 10 ++++-----
 5 files changed, 70 insertions(+), 70 deletions(-)
 create mode 100644 src/backend/dlpkg.py
 delete mode 100644 src/backend/download.py

(limited to 'src/backend')

diff --git a/src/backend/__init__.py b/src/backend/__init__.py
index d6dc4c7..ccfb27a 100644
--- a/src/backend/__init__.py
+++ b/src/backend/__init__.py
@@ -1,6 +1,6 @@
 from .autoremove import *
 from .checkenv import *
-from .download import *
+from .dlpkg import *
 from .getcolor import *
 from .getenv import *
 from .getfs import *
diff --git a/src/backend/dlpkg.py b/src/backend/dlpkg.py
new file mode 100644
index 0000000..ce089ad
--- /dev/null
+++ b/src/backend/dlpkg.py
@@ -0,0 +1,59 @@
+#!/usr/bin/python3
+
+import atexit
+import io
+import os
+import signal
+import subprocess
+import sys
+import pickle
+import sisyphus.getfs
+import sisyphus.killemerge
+
+
+def sigint_handler(signal, frame):
+    sys.exit(0)
+
+
+signal.signal(signal.SIGINT, sigint_handler)
+
+
+def start(dl_world=False, gfx_ui=False):
+    dl_list = []
+
+    if dl_world:
+        file_path = os.path.join(
+            sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle")
+    else:
+        file_path = os.path.join(
+            sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle")
+
+    with open(file_path, "rb") as f:
+        bin_list, src_list, is_vague, need_cfg = pickle.load(f)
+
+    dl_list = [f'={package}' for package in bin_list]
+
+    args = ['--nodeps', '--quiet', '--verbose', '--getbinpkg', '--fetchonly', '--rebuilt-binaries',
+            '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list)
+
+    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.killemerge.start, p_exe)
+
+        for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"):
+            print(p_out.rstrip())
+
+        p_exe.wait()
+    else:
+        p_exe = subprocess.Popen(['emerge'] + args)
+        try:
+            p_exe.wait()
+        except KeyboardInterrupt:
+            p_exe.terminate()
+            try:
+                p_exe.wait(1)
+            except subprocess.TimeoutExpired:
+                p_exe.kill()
+            sys.exit()
diff --git a/src/backend/download.py b/src/backend/download.py
deleted file mode 100644
index ce089ad..0000000
--- a/src/backend/download.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python3
-
-import atexit
-import io
-import os
-import signal
-import subprocess
-import sys
-import pickle
-import sisyphus.getfs
-import sisyphus.killemerge
-
-
-def sigint_handler(signal, frame):
-    sys.exit(0)
-
-
-signal.signal(signal.SIGINT, sigint_handler)
-
-
-def start(dl_world=False, gfx_ui=False):
-    dl_list = []
-
-    if dl_world:
-        file_path = os.path.join(
-            sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle")
-    else:
-        file_path = os.path.join(
-            sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle")
-
-    with open(file_path, "rb") as f:
-        bin_list, src_list, is_vague, need_cfg = pickle.load(f)
-
-    dl_list = [f'={package}' for package in bin_list]
-
-    args = ['--nodeps', '--quiet', '--verbose', '--getbinpkg', '--fetchonly', '--rebuilt-binaries',
-            '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(dl_list)
-
-    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.killemerge.start, p_exe)
-
-        for p_out in io.TextIOWrapper(p_exe.stdout, encoding="utf-8"):
-            print(p_out.rstrip())
-
-        p_exe.wait()
-    else:
-        p_exe = subprocess.Popen(['emerge'] + args)
-        try:
-            p_exe.wait()
-        except KeyboardInterrupt:
-            p_exe.terminate()
-            try:
-                p_exe.wait(1)
-            except subprocess.TimeoutExpired:
-                p_exe.kill()
-            sys.exit()
diff --git a/src/backend/install.py b/src/backend/install.py
index 6527a48..5e9b3b8 100644
--- a/src/backend/install.py
+++ b/src/backend/install.py
@@ -9,7 +9,7 @@ import subprocess
 import sys
 import time
 import sisyphus.checkenv
-import sisyphus.download
+import sisyphus.dlpkg
 import sisyphus.getcolor
 import sisyphus.getfs
 import sisyphus.killemerge
@@ -140,7 +140,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False):
                     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', '']:
-                        sisyphus.download.start(dl_world=False, gfx_ui=False)
+                        sisyphus.dlpkg.start(dl_world=False, gfx_ui=False)
                         os.chdir(sisyphus.getfs.p_cch_dir)
                         p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--rebuilt-binaries', '--with-bdeps=y',
                                                  '--misspell-suggestion=n', '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname))
@@ -172,7 +172,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False):
                     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', '']:
-                        sisyphus.download.start(dl_world=False, gfx_ui=False)
+                        sisyphus.dlpkg.start(dl_world=False, gfx_ui=False)
                         os.chdir(sisyphus.getfs.p_cch_dir)
                         p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries',
                                                  '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + (['--oneshot'] if oneshot else []) + list(pkgname))
@@ -234,7 +234,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False):
                         "\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")
-                    sisyphus.download.start(dl_world=False, gfx_ui=True)
+                    sisyphus.dlpkg.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',
                                              '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -257,7 +257,7 @@ def start(pkgname, ebuild=False, gfx_ui=False, oneshot=False):
                         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', '']:
-                            sisyphus.download.start(
+                            sisyphus.dlpkg.start(
                                 dl_world=False, gfx_ui=False)
                             os.chdir(sisyphus.getfs.p_cch_dir)
                             p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--usepkg', '--usepkgonly', '--rebuilt-binaries',
diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py
index 712bec0..cec6061 100644
--- a/src/backend/upgrade.py
+++ b/src/backend/upgrade.py
@@ -9,7 +9,7 @@ import subprocess
 import sys
 import time
 import sisyphus.checkenv
-import sisyphus.download
+import sisyphus.dlpkg
 import sisyphus.getcolor
 import sisyphus.getfs
 import sisyphus.killemerge
@@ -126,7 +126,7 @@ def start(ebuild=False, gfx_ui=False):
                     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', '']:
-                        sisyphus.download.start(dl_world=True, gfx_ui=False)
+                        sisyphus.dlpkg.start(dl_world=True, gfx_ui=False)
                         os.chdir(sisyphus.getfs.p_cch_dir)
                         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'])
@@ -158,7 +158,7 @@ def start(ebuild=False, gfx_ui=False):
                     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', '']:
-                        sisyphus.download.start(dl_world=True, gfx_ui=False)
+                        sisyphus.dlpkg.start(dl_world=True, gfx_ui=False)
                         os.chdir(sisyphus.getfs.p_cch_dir)
                         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'])
@@ -220,7 +220,7 @@ def start(ebuild=False, gfx_ui=False):
                         "\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")
-                    sisyphus.download.start(dl_world=True, gfx_ui=True)
+                    sisyphus.dlpkg.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',
                                              '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -243,7 +243,7 @@ def start(ebuild=False, gfx_ui=False):
                         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', '']:
-                            sisyphus.download.start(
+                            sisyphus.dlpkg.start(
                                 dl_world=True, gfx_ui=False)
                             os.chdir(sisyphus.getfs.p_cch_dir)
                             p_exe = subprocess.Popen(['emerge', '--quiet', '--verbose', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly',
-- 
cgit v1.2.3