summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-09-17 23:24:05 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-09-17 23:24:05 +0100
commit00c597fbd8d309bd74f91aae27af84a1e93a4a0d (patch)
treeeda95fa33297244c09289e0fceccca6b8bc9d32d /src/backend
parent44f48531452bc55114161df8f33a0cd49c7d438c (diff)
get rid of io.TextIOWrapper
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/autoRemoveAll.py9
-rw-r--r--src/backend/getBinhost.py9
-rw-r--r--src/backend/installPkg.py21
-rw-r--r--src/backend/installSrc.py43
-rw-r--r--src/backend/resolveDeps.py45
-rw-r--r--src/backend/setProfile.py4
-rw-r--r--src/backend/syncEnvironment.py20
-rw-r--r--src/backend/uninstallAll.py9
-rw-r--r--src/backend/uninstallAllForce.py2
-rw-r--r--src/backend/upgradePkg.py21
-rw-r--r--src/backend/upgradeSrc.py43
11 files changed, 109 insertions, 117 deletions
diff --git a/src/backend/autoRemoveAll.py b/src/backend/autoRemoveAll.py
index 65274a6..18dd386 100644
--- a/src/backend/autoRemoveAll.py
+++ b/src/backend/autoRemoveAll.py
@@ -1,7 +1,6 @@
#!/usr/bin/python3
import atexit
-import io
import subprocess
import sys
import sisyphus.checkEnvironment
@@ -11,18 +10,18 @@ import sisyphus.syncDatabase
def start():
if sisyphus.checkEnvironment.root():
portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- portageExec.communicate()
+ portageExec.wait()
sisyphus.syncDatabase.syncLocal()
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
def startqt():
portageExec = subprocess.Popen(['emerge', '--depclean'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
# 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"):
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
diff --git a/src/backend/getBinhost.py b/src/backend/getBinhost.py
index 849dba8..befa1f3 100644
--- a/src/backend/getBinhost.py
+++ b/src/backend/getBinhost.py
@@ -1,15 +1,14 @@
#!/usr/bin/python3
-import io
import subprocess
def start():
isBinhost = []
portageExec = subprocess.Popen(['emerge', '--info', '--verbose'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
- for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
- if "PORTAGE_BINHOST" in portageOutput.rstrip():
- isBinhost = str(portageOutput.rstrip().split("=")[1].strip('\"'))
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if "PORTAGE_BINHOST" in portageOutput:
+ isBinhost = portageOutput.rstrip().split("=")[1].strip('\"')
- portageExec.communicate()
return isBinhost
diff --git a/src/backend/installPkg.py b/src/backend/installPkg.py
index c6af1d7..7b98fc4 100644
--- a/src/backend/installPkg.py
+++ b/src/backend/installPkg.py
@@ -1,7 +1,6 @@
#!/usr/bin/python3
import atexit
-import io
import os
import shutil
import subprocess
@@ -43,13 +42,13 @@ def start(pkgname):
os.remove(binary.rstrip().split("/")[1])
portageExec = subprocess.Popen(['emerge', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
- 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():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "These are the packages that would be merged, in order:" in portageOutput:
+ if not "Calculating dependencies" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
@@ -84,13 +83,13 @@ def startqt(pkgname):
os.remove(binary.rstrip().split("/")[1])
portageExec = subprocess.Popen(['emerge', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
# 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():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "These are the packages that would be merged, in order:" in portageOutput:
+ if not "Calculating dependencies" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
diff --git a/src/backend/installSrc.py b/src/backend/installSrc.py
index 466ee0a..420b4d5 100644
--- a/src/backend/installSrc.py
+++ b/src/backend/installSrc.py
@@ -1,6 +1,5 @@
#!/usr/bin/python3
-import io
import os
import shutil
import subprocess
@@ -41,13 +40,13 @@ def start(pkgname):
os.remove(binary.rstrip().split("/")[1])
portageExec = subprocess.Popen(['emerge', '--usepkg', '--usepkgonly', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
- 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():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "These are the packages that would be merged, in order:" in portageOutput:
+ if not "Calculating dependencies" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
@@ -74,13 +73,13 @@ def start(pkgname):
os.remove(binary.rstrip().split("/")[1])
portageExec = subprocess.Popen(['emerge', '--usepkg', '--rebuilt-binaries', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
- 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():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "These are the packages that would be merged, in order:" in portageOutput:
+ if not "Calculating dependencies" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
@@ -88,26 +87,26 @@ def start(pkgname):
print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + " ".join(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n")
if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y":
portageExec = subprocess.Popen(['emerge', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
- 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():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "These are the packages that would be merged, in order:" in portageOutput:
+ if not "Calculating dependencies" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
else:
portageExec = 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)
+ stdout, stderr = portageExec.communicate()
- for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
- if not "Local copy of remote index is up-to-date and will be used." in portageOutput.rstrip():
- if not "ebuild" in portageOutput.rstrip():
- if not "binary" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "Local copy of remote index is up-to-date and will be used." in portageOutput:
+ if not "ebuild" in portageOutput:
+ if not "binary" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; Quitting." + "\n")
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
diff --git a/src/backend/resolveDeps.py b/src/backend/resolveDeps.py
index b889d5d..517c574 100644
--- a/src/backend/resolveDeps.py
+++ b/src/backend/resolveDeps.py
@@ -1,7 +1,6 @@
#!/usr/bin/python3
import animation
-import io
import subprocess
@animation.wait('resolving dependencies')
@@ -10,30 +9,30 @@ def package(pkgname):
areSources = []
needsConfig = int()
portageExec = 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)
+ stdout, stderr = portageExec.communicate()
- for portageOutput in io.TextIOWrapper(portageExec.stderr, encoding="utf-8"):
- if "The following keyword changes are necessary to proceed:" in portageOutput.rstrip():
+ for portageOutput in stderr.decode('ascii').splitlines():
+ if "The following keyword changes are necessary to proceed:" in portageOutput:
needsConfig = int(1)
- if "The following mask changes are necessary to proceed:" in portageOutput.rstrip():
+ if "The following mask changes are necessary to proceed:" in portageOutput:
needsConfig = int(1)
- if "The following USE changes are necessary to proceed:" in portageOutput.rstrip():
+ if "The following USE changes are necessary to proceed:" in portageOutput:
needsConfig = int(1)
- if "The following REQUIRED_USE flag constraints are unsatisfied:" in portageOutput.rstrip():
+ if "The following REQUIRED_USE flag constraints are unsatisfied:" in portageOutput:
needsConfig = int(1)
- for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
- if "[binary" in portageOutput.rstrip():
- isBinary = str(portageOutput.rstrip().split("]")[1].split("[")[0].strip("\ "))
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if "[binary" in portageOutput:
+ isBinary = portageOutput.split("]")[1].split("[")[0].strip(" ")
areBinaries.append(isBinary)
- if "[ebuild" in portageOutput.rstrip():
- isSource = str(portageOutput.rstrip().split("]")[1].split("[")[0].strip("\ "))
+ if "[ebuild" in portageOutput:
+ isSource = portageOutput.split("]")[1].split("[")[0].strip(" ")
areSources.append(isSource)
- portageExec.communicate()
return areBinaries,areSources,needsConfig
@animation.wait('resolving dependencies')
@@ -42,28 +41,28 @@ def world():
areSources = []
needsConfig = int()
portageExec = 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 = portageExec.communicate()
- for portageOutput in io.TextIOWrapper(portageExec.stderr, encoding="utf-8"):
- if "The following keyword changes are necessary to proceed:" in portageOutput.rstrip():
+ for portageOutput in stderr.decode('ascii').splitlines():
+ if "The following keyword changes are necessary to proceed:" in portageOutput:
needsConfig = int(1)
- if "The following mask changes are necessary to proceed:" in portageOutput.rstrip():
+ if "The following mask changes are necessary to proceed:" in portageOutput:
needsConfig = int(1)
- if "The following USE changes are necessary to proceed:" in portageOutput.rstrip():
+ if "The following USE changes are necessary to proceed:" in portageOutput:
needsConfig = int(1)
- if "The following REQUIRED_USE flag constraints are unsatisfied:" in portageOutput.rstrip():
+ if "The following REQUIRED_USE flag constraints are unsatisfied:" in portageOutput:
needsConfig = int(1)
- for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
- if "[binary" in portageOutput.rstrip():
- isBinary = str(portageOutput.rstrip().split("]")[1].split("[")[0].strip("\ "))
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if "[binary" in portageOutput:
+ isBinary = portageOutput.split("]")[1].split("[")[0].strip(" ")
areBinaries.append(isBinary)
- if "[ebuild" in portageOutput.rstrip():
- isSource = str(portageOutput.rstrip().split("]")[1].split("[")[0].strip("\ "))
+ if "[ebuild" in portageOutput:
+ isSource = portageOutput.split("]")[1].split("[")[0].strip(" ")
areSources.append(isSource)
- portageExec.communicate()
return areBinaries,areSources,needsConfig
diff --git a/src/backend/setProfile.py b/src/backend/setProfile.py
index 78a8b60..d3942aa 100644
--- a/src/backend/setProfile.py
+++ b/src/backend/setProfile.py
@@ -8,11 +8,11 @@ import subprocess
def start():
if platform.uname()[4] == 'x86_64':
eselectExec = subprocess.Popen(['eselect', 'profile', 'set', 'default/linux/amd64/17.1/hardened'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- eselectExec.communicate()
+ eselectExec.wait()
if platform.uname()[4] == 'aarch64':
eselectExec = subprocess.Popen(['eselect', 'profile', 'set', 'default/linux/arm64/17.0'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- eselectExec.communicate()
+ eselectExec.wait()
envExec = subprocess.Popen(['env-update'], stdout=subprocess.DEVNULL)
envExec.wait()
diff --git a/src/backend/syncEnvironment.py b/src/backend/syncEnvironment.py
index 47beb77..4473115 100644
--- a/src/backend/syncEnvironment.py
+++ b/src/backend/syncEnvironment.py
@@ -10,10 +10,10 @@ def syncStage1():
remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- gitExecStage1.communicate()
+ gitExecStage1.wait()
gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- gitExecStage2.communicate()
+ gitExecStage2.wait()
def syncStage2():
os.chdir(sisyphus.getFilesystem.redcoreRepoDir)
@@ -21,10 +21,10 @@ def syncStage2():
remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
gitExecStage1 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- gitExecStage1.communicate()
+ gitExecStage1.wait()
gitExecStage2 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- gitExecStage2.communicate()
+ gitExecStage2.wait()
def syncStage3():
os.chdir(sisyphus.getFilesystem.portageConfigDir)
@@ -32,14 +32,14 @@ def syncStage3():
remoteBranch = subprocess.check_output(['git', 'rev-parse', '--symbolic-full-name', '@{u}'])
gitExecStage1 = subprocess.Popen(['git', 'stash'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- gitExecStage1.communicate()
+ gitExecStage1.wait()
gitExecStage2 = subprocess.Popen(['git', 'fetch', '--depth=1', 'origin'] + localBranch.decode().strip().split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- gitExecStage2.communicate()
+ gitExecStage2.wait()
gitExecStage3 = subprocess.Popen(['git', 'reset', '--hard'] + remoteBranch.decode().strip().replace('refs/remotes/','').split() + ['--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- gitExecStage3.communicate()
+ gitExecStage3.wait()
gitExecStage4 = subprocess.Popen(['git', 'stash', 'apply'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- gitExecStage4.communicate()
+ gitExecStage4.wait()
gitExecStage5 = subprocess.Popen(['git', 'stash', 'clear'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- gitExecStage5.communicate()
+ gitExecStage5.wait()
gitExecStage6 = subprocess.Popen(['git', 'gc', '--prune=now', '--quiet'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- gitExecStage6.communicate()
+ gitExecStage6.wait()
diff --git a/src/backend/uninstallAll.py b/src/backend/uninstallAll.py
index bb54851..b11af3e 100644
--- a/src/backend/uninstallAll.py
+++ b/src/backend/uninstallAll.py
@@ -1,7 +1,6 @@
#!/usr/bin/python3
import atexit
-import io
import subprocess
import sys
import sisyphus.checkEnvironment
@@ -11,18 +10,18 @@ import sisyphus.syncDatabase
def start(pkgname):
if sisyphus.checkEnvironment.root():
portageExec = subprocess.Popen(['emerge', '--quiet', '--depclean', '--ask'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- portageExec.communicate()
+ portageExec.wait()
sisyphus.syncDatabase.syncLocal()
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
def startqt(pkgname):
portageExec = subprocess.Popen(['emerge', '--depclean'] + pkgname, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
# 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"):
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
diff --git a/src/backend/uninstallAllForce.py b/src/backend/uninstallAllForce.py
index d639fe8..1c37ace 100644
--- a/src/backend/uninstallAllForce.py
+++ b/src/backend/uninstallAllForce.py
@@ -8,7 +8,7 @@ import sisyphus.syncDatabase
def start(pkgname):
if sisyphus.checkEnvironment.root():
portageExec = subprocess.Popen(['emerge', '--quiet', '--unmerge', '--ask'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- portageExec.communicate()
+ portageExec.wait()
sisyphus.syncDatabase.syncLocal()
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")
diff --git a/src/backend/upgradePkg.py b/src/backend/upgradePkg.py
index c2176e9..293dc66 100644
--- a/src/backend/upgradePkg.py
+++ b/src/backend/upgradePkg.py
@@ -1,7 +1,6 @@
#!/usr/bin/python3
import atexit
-import io
import os
import shutil
import subprocess
@@ -43,13 +42,13 @@ def start():
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, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
- 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():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "These are the packages that would be merged, in order:" in portageOutput:
+ if not "Calculating dependencies" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
@@ -88,15 +87,15 @@ def startqt():
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, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
# 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():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "These are the packages that would be merged, in order:" in portageOutput:
+ if not "Calculating dependencies" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
else:
print("\n" + "No package upgrades found; Quitting." + "\n")
diff --git a/src/backend/upgradeSrc.py b/src/backend/upgradeSrc.py
index db4f8cb..e378a8a 100644
--- a/src/backend/upgradeSrc.py
+++ b/src/backend/upgradeSrc.py
@@ -1,6 +1,5 @@
#!/usr/bin/python3
-import io
import os
import shutil
import subprocess
@@ -41,13 +40,13 @@ def start():
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, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
- 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():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "These are the packages that would be merged, in order:" in portageOutput:
+ if not "Calculating dependencies" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
@@ -74,13 +73,13 @@ def start():
os.remove(binary.rstrip().split("/")[1])
portageExec = subprocess.Popen(['emerge', '--update', '--deep', '--newuse', '--usepkg', '--rebuilt-binaries', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
- 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():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "These are the packages that would be merged, in order:" in portageOutput:
+ if not "Calculating dependencies" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
@@ -88,26 +87,26 @@ def start():
print("\n" + "These are the source packages that would be merged, in order:" + "\n\n" + " ".join(areSources) + "\n\n" + "Total:" + " " + str(len(areSources)) + " " + "source package(s)" + "\n")
if input("Would you like to proceed?" + " " + "[y/N]" + " ").lower().strip()[:1] == "y":
portageExec = subprocess.Popen(['emerge', '--update', '--deep', '--newuse', '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = portageExec.communicate()
- 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():
- if not "Calculating dependencies" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "These are the packages that would be merged, in order:" in portageOutput:
+ if not "Calculating dependencies" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sisyphus.syncDatabase.syncLocal()
else:
sys.exit("\n" + "Ok; Quitting." + "\n")
else:
portageExec = 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 = portageExec.communicate()
- for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
- if not "Local copy of remote index is up-to-date and will be used." in portageOutput.rstrip():
- if not "ebuild" in portageOutput.rstrip():
- if not "binary" in portageOutput.rstrip():
- print(portageOutput.rstrip())
+ for portageOutput in stdout.decode('ascii').splitlines():
+ if not "Local copy of remote index is up-to-date and will be used." in portageOutput:
+ if not "ebuild" in portageOutput:
+ if not "binary" in portageOutput:
+ print(portageOutput)
- portageExec.communicate()
sys.exit("\n" + "Cannot proceed; Apply the above changes to your portage configuration files and try again; Quitting." + "\n")
else:
sys.exit("\nYou need root permissions to do this, exiting!\n")