summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/__init__.py2
-rw-r--r--src/backend/cache.py (renamed from src/backend/clean.py)3
-rw-r--r--src/backend/update.py4
-rw-r--r--src/frontend/gui/sisyphus-gui.py60
4 files changed, 38 insertions, 31 deletions
diff --git a/src/backend/__init__.py b/src/backend/__init__.py
index 1b012e3..c5f8f58 100644
--- a/src/backend/__init__.py
+++ b/src/backend/__init__.py
@@ -3,8 +3,8 @@ from .branchinject import *
from .branchmaster import *
from .branchnext import *
from .branchreset import *
+from .cache import *
from .check import *
-from .clean import *
from .csvfiles import *
from .database import *
from .help import *
diff --git a/src/backend/clean.py b/src/backend/cache.py
index 2460d9e..aaa0a32 100644
--- a/src/backend/clean.py
+++ b/src/backend/cache.py
@@ -1,10 +1,11 @@
#!/usr/bin/python3
import os
+import shutil
portageCacheDir = '/var/cache/packages'
-def cache():
+def clean():
if os.path.isdir(portageCacheDir):
for files in os.listdir(portageCacheDir):
if os.path.isfile(os.path.join(portageCacheDir, files)):
diff --git a/src/backend/update.py b/src/backend/update.py
index dd184d2..738de3a 100644
--- a/src/backend/update.py
+++ b/src/backend/update.py
@@ -1,8 +1,8 @@
#!/usr/bin/python3
import animation
+import sisyphus.cache
import sisyphus.check
-import sisyphus.clean
import sisyphus.database
import sisyphus.metadata
import sisyphus.sync
@@ -10,7 +10,7 @@ import sisyphus.sync
@animation.wait('fetching updates')
def start():
sisyphus.check.root()
- sisyphus.clean.cache()
+ sisyphus.cache.clean()
needsPortage = sisyphus.check.portage()
needsOverlay = sisyphus.check.overlay()
diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py
index 3c89200..12e8da4 100644
--- a/src/frontend/gui/sisyphus-gui.py
+++ b/src/frontend/gui/sisyphus-gui.py
@@ -1,4 +1,6 @@
#!/usr/bin/python3
+
+import os
import sys
import subprocess
import sqlite3
@@ -6,9 +8,9 @@ import io
import atexit
import wget
import shutil
+import sisyphus
from collections import OrderedDict
from PyQt5 import QtCore, QtGui, QtWidgets, uic
-from libsisyphus import *
class Sisyphus(QtWidgets.QMainWindow):
@@ -202,7 +204,7 @@ class Sisyphus(QtWidgets.QMainWindow):
AND iv <> av
''' % (Sisyphus.applicationView, Sisyphus.searchTerm, noVirtual)),
])
- with sqlite3.connect(sisyphusDB) as db:
+ with sqlite3.connect(sisyphus.database.sisyphusDB) as db:
cursor = db.cursor()
cursor.execute('%s' % (self.SELECTS[Sisyphus.databaseView]))
rows = cursor.fetchall()
@@ -387,9 +389,9 @@ class MainWorker(QtCore.QObject):
@QtCore.pyqtSlot()
def startUpdate(self):
self.started.emit()
- checkUpdate()
- setJobs.__wrapped__() #undecorate
- startUpdate.__wrapped__() #undecorate
+ sisyphus.check.update()
+ sisyphus.setjobs.start.__wrapped__() # undecorate
+ sisyphus.update.start.__wrapped__() # undecorate
self.finished.emit()
@QtCore.pyqtSlot()
@@ -397,10 +399,10 @@ class MainWorker(QtCore.QObject):
self.started.emit()
pkgList = Sisyphus.pkgList
- binhostURL = getBinhostURL()
- areBinaries,areSources,needsConfig = getPackageDeps.__wrapped__(pkgList) #undecorate
+ binhostURL = sisyphus.binhost.getURL()
+ areBinaries,areSources,needsConfig = sisyphus.solvedeps.package.__wrapped__(pkgList) #undecorate
- os.chdir(portageCacheDir)
+ os.chdir(sisyphus.cache.portageCacheDir)
self.workerOutput.emit("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n")
for index, binary in enumerate([package + '.tbz2' for package in areBinaries]):
self.workerOutput.emit(">>> Fetching" + " " + binhostURL + binary)
@@ -413,18 +415,19 @@ class MainWorker(QtCore.QObject):
if os.path.exists(binary.rstrip().split("/")[1].replace('tbz2', 'xpak')):
os.remove(binary.rstrip().split("/")[1].replace('tbz2', 'xpak'))
- if os.path.isdir(os.path.join(portageCacheDir, CATEGORY.decode().strip())):
- shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1])))
+ if os.path.isdir(os.path.join(sisyphus.cache.portageCacheDir, CATEGORY.decode().strip())):
+ shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.cache.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1])))
else:
- os.makedirs(os.path.join(portageCacheDir, CATEGORY.decode().strip()))
- shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1])))
+ os.makedirs(os.path.join(sisyphus.cache.portageCacheDir, CATEGORY.decode().strip()))
+ shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.cache.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1])))
if os.path.exists(binary.rstrip().split("/")[1]):
os.remove(binary.rstrip().split("/")[1])
portageExec = subprocess.Popen(['emerge', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgList, stdout=subprocess.PIPE)
- atexit.register(portageKill, portageExec)
+ # kill portage if the program dies or it's terminated by the user
+ atexit.register(sisyphus.killportage.start, portageExec)
for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
@@ -432,7 +435,7 @@ class MainWorker(QtCore.QObject):
self.workerOutput.emit(portageOutput.rstrip() + "\n")
portageExec.wait()
- syncLocalDatabase()
+ sisyphus.database.syncLocal()
self.finished.emit()
@QtCore.pyqtSlot()
@@ -441,28 +444,29 @@ class MainWorker(QtCore.QObject):
pkgList = Sisyphus.pkgList
portageExec = subprocess.Popen(['emerge', '--depclean'] + pkgList, stdout=subprocess.PIPE)
- atexit.register(portageKill, portageExec)
+ # kill portage if the program dies or it's terminated by the user
+ atexit.register(sisyphus.killportage.start, portageExec)
for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
self.workerOutput.emit(portageOutput.rstrip() + "\n")
portageExec.wait()
- syncLocalDatabase()
+ sisyphus.database.syncLocal()
self.finished.emit()
@QtCore.pyqtSlot()
def startUpgrade(self):
self.started.emit()
- binhostURL = getBinhostURL()
- areBinaries,areSources,needsConfig = getWorldDeps.__wrapped__() #undecorate
+ binhostURL = sisyphus.binhost.getURL()
+ areBinaries,areSources,needsConfig = sisyphus.solvedeps.world.__wrapped__() #undecorate
if not len(areSources) == 0:
self.workerOutput.emit("\n" + "Source package upgrades detected; Use sisyphus CLI to perform the upgrade; Aborting." + "\n")
else:
if not len(areBinaries) == 0:
self.workerOutput.emit("\n" + "These are the binary packages that will be merged, in order:" + "\n\n" + str(areBinaries) + "\n\n" + "Total:" + " " + str(len(areBinaries)) + " " + "binary package(s)" + "\n\n")
- os.chdir(portageCacheDir)
+ os.chdir(sisyphus.cache.portageCacheDir)
for index, binary in enumerate([package + '.tbz2' for package in areBinaries]):
self.workerOutput.emit(">>> Fetching" + " " + binhostURL + binary)
wget.download(binhostURL + binary)
@@ -474,18 +478,19 @@ class MainWorker(QtCore.QObject):
if os.path.exists(binary.rstrip().split("/")[1].replace('tbz2', 'xpak')):
os.remove(binary.rstrip().split("/")[1].replace('tbz2', 'xpak'))
- if os.path.isdir(os.path.join(portageCacheDir, CATEGORY.decode().strip())):
- shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1])))
+ if os.path.isdir(os.path.join(sisyphus.cache.portageCacheDir, CATEGORY.decode().strip())):
+ shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.cache.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1])))
else:
- os.makedirs(os.path.join(portageCacheDir, CATEGORY.decode().strip()))
- shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1])))
+ os.makedirs(os.path.join(sisyphus.cache.portageCacheDir, CATEGORY.decode().strip()))
+ shutil.move(binary.rstrip().split("/")[1], os.path.join(os.path.join(sisyphus.cache.portageCacheDir, CATEGORY.decode().strip()), os.path.basename(binary.rstrip().split("/")[1])))
if os.path.exists(binary.rstrip().split("/")[1]):
os.remove(binary.rstrip().split("/")[1])
portageExec = subprocess.Popen(['emerge', '--update', '--deep', '--newuse', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE)
- atexit.register(portageKill, portageExec)
+ # kill portage if the program dies or it's terminated by the user
+ atexit.register(sisyphus.killportage.start, portageExec)
for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
if not "These are the packages that would be merged, in order:" in portageOutput.rstrip():
@@ -493,7 +498,7 @@ class MainWorker(QtCore.QObject):
self.workerOutput.emit(portageOutput.rstrip() + "\n")
portageExec.wait()
- syncLocalDatabase()
+ sisyphus.database.syncLocal()
else:
self.workerOutput.emit("\n" + "No package upgrades found; Quitting." + "\n")
@@ -504,13 +509,14 @@ class MainWorker(QtCore.QObject):
self.started.emit()
portageExec = subprocess.Popen(['emerge', '--depclean'], stdout=subprocess.PIPE)
- atexit.register(portageKill, portageExec)
+ # kill portage if the program dies or it's terminated by the user
+ atexit.register(sisyphus.killportage.start, portageExec)
for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
self.workerOutput.emit(portageOutput.rstrip() + "\n")
portageExec.wait()
- syncLocalDatabase()
+ sisyphus.database.syncLocal()
self.finished.emit()