diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2021-01-31 01:19:56 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2021-01-31 01:19:56 +0000 |
commit | e4f2e722b2740d16ddc2ffa9b184287a7850b203 (patch) | |
tree | d22fa625f7d4a31625d8153d2630c3a71f58b978 /src/backend/csvfiles.py | |
parent | 5eaef5fdcc4648c6156b0a5f6d8a2907c2a5a303 (diff) |
backend : reuse binhost module in csvfiles module, one less portage call
Diffstat (limited to 'src/backend/csvfiles.py')
-rw-r--r-- | src/backend/csvfiles.py | 20 |
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 |