summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-01-31 01:26:21 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-01-31 01:26:21 +0000
commitf59f14aee1d1a82b60e4274e4680b54280c225c5 (patch)
treef619c8353522add317ba00a5a9dea55f3716f4e0 /src/backend
parente5d40ebec925b9e0f308fa55930f7fd03f02a693 (diff)
backend : reuse binhost module in csvfiles module, one less portage call
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/csvfiles.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/backend/csvfiles.py b/src/backend/csvfiles.py
index 0c91e81..0d2e895 100644
--- a/src/backend/csvfiles.py
+++ b/src/backend/csvfiles.py
@@ -1,21 +1,17 @@
#!/usr/bin/python3
-import subprocess
-import io
+import sisyphus.binhost
def getURL():
remotePackagesCsvURL = []
remoteDescriptionsCsvURL = []
- portageExec = subprocess.Popen(['emerge', '--info', '--verbose'], stdout=subprocess.PIPE)
+ binhostURL = sisyphus.binhost.getURL()
- for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"):
- if "PORTAGE_BINHOST" in portageOutput.rstrip():
- if "packages-next" in portageOutput.rstrip():
- remotePackagesCsvURL = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages-next', 'csv-next') + 'remotePackagesPre.csv')
- remoteDescriptionsCsvURL = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages-next', 'csv-next') + 'remoteDescriptionsPre.csv')
- else:
- remotePackagesCsvURL = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages', 'csv') + 'remotePackagesPre.csv')
- remoteDescriptionsCsvURL = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages', 'csv') + 'remoteDescriptionsPre.csv')
+ if "packages-next" in binhostURL:
+ remotePackagesCsvURL = binhostURL.replace('packages-next', 'csv-next') + 'remotePackagesPre.csv'
+ remoteDescriptionsCsvURL = binhostURL.replace('packages-next', 'csv-next') + 'remoteDescriptionsPre.csv'
+ else:
+ remotePackagesCsvURL = binhostURL.replace('packages', 'csv') + 'remotePackagesPre.csv'
+ remoteDescriptionsCsvURL = binhostURL.replace('packages', 'csv') + 'remoteDescriptionsPre.csv'
- portageExec.wait()
return remotePackagesCsvURL,remoteDescriptionsCsvURL