diff options
Diffstat (limited to 'src/backend/csvfiles.py')
-rw-r--r-- | src/backend/csvfiles.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/backend/csvfiles.py b/src/backend/csvfiles.py new file mode 100644 index 0000000..67daec4 --- /dev/null +++ b/src/backend/csvfiles.py @@ -0,0 +1,21 @@ +#!/usr/bin/python3 + +import subprocess +import io + +def getURL(): + remotePkgCsv = [] + remoteDescCsv = [] + portageExec = subprocess.Popen(['emerge', '--info', '--verbose'], stdout=subprocess.PIPE) + + for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): + if "PORTAGE_BINHOST" in portageOutput.rstrip(): + if "packages-next" in portageOutput.rstrip(): + remotePkgCsv = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages-next', 'csv-next') + 'remotePackagesPre.csv') + remoteDescCsv = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages-next', 'csv-next') + 'remoteDescriptionsPre.csv') + else: + remotePkgCsv = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages', 'csv') + 'remotePackagesPre.csv') + remoteDescCsv = str(portageOutput.rstrip().split("=")[1].strip('\"').replace('packages', 'csv') + 'remoteDescriptionsPre.csv') + + portageExec.wait() + return remotePkgCsv,remoteDescCsv |