summaryrefslogtreecommitdiff
path: root/src/backend/binhost.py
blob: 5bcf20c0d510985f4396d92e0ab7782d9736cec9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/python3

import subprocess
import io

def getURL():
    binhostURL = []
    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():
            binhostURL = str(portageOutput.rstrip().split("=")[1].strip('\"'))

    portageExec.wait()
    return binhostURL