diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-10-30 14:26:52 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-10-30 14:26:52 +0000 |
commit | 02b654dc089c570ce81ce5da0c2c48d5d21d3cb8 (patch) | |
tree | 2a32a8634b59efc8b9f28ec8d8732cdd6b3b3414 /src/backend/getenv.py | |
parent | 331cd284de1de5f7192e1588b836f89337326784 (diff) |
move getEnvironment -> getenv
Diffstat (limited to 'src/backend/getenv.py')
-rw-r--r-- | src/backend/getenv.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/backend/getenv.py b/src/backend/getenv.py new file mode 100644 index 0000000..5edd038 --- /dev/null +++ b/src/backend/getenv.py @@ -0,0 +1,29 @@ +#!/usr/bin/python3 + +import io +import subprocess + +def binhostURL(): + binhostURL = [] + portageExec = subprocess.Popen(['emerge', '--info', '--verbose'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + for portageOutput in io.TextIOWrapper(portageExec.stdout, encoding="utf-8"): + if "PORTAGE_BINHOST" in portageOutput: + binhostURL = portageOutput.rstrip().split("=")[1].strip('\"') + + portageExec.wait() + return binhostURL + +def csvURL(): + csvURL = binhostURL() + packagesCsvURL = [] + descriptionsCsvURL = [] + + if "packages-next" in csvURL: + packagesCsvURL = csvURL.replace('packages-next', 'csv-next') + 'remotePackagesPre.csv' + descriptionsCsvURL = csvURL.replace('packages-next', 'csv-next') + 'remoteDescriptionsPre.csv' + else: + packagesCsvURL = csvURL.replace('packages', 'csv') + 'remotePackagesPre.csv' + descriptionsCsvURL = csvURL.replace('packages', 'csv') + 'remoteDescriptionsPre.csv' + + return packagesCsvURL,descriptionsCsvURL |