diff --git a/config.json b/config.json index 8692b1f..304825f 100644 --- a/config.json +++ b/config.json @@ -5,6 +5,6 @@ "THEME": "default" }, "Portage":{ - "make.conf":"/etc/portge/make.conf/custom" + "make.conf":"/etc/portage/make.conf/custom" } } \ No newline at end of file diff --git a/utils/__pycache__/utils.cpython-39.pyc b/utils/__pycache__/utils.cpython-39.pyc index 1f79ed6..a71f773 100644 Binary files a/utils/__pycache__/utils.cpython-39.pyc and b/utils/__pycache__/utils.cpython-39.pyc differ diff --git a/utils/parsePortage.py b/utils/parsePortage.py index 9a31311..3729fdd 100644 --- a/utils/parsePortage.py +++ b/utils/parsePortage.py @@ -15,20 +15,20 @@ class PortageConfig(): def parseMakeConf(self): StateBox = 'Null' - Lines = self.getlines(self.Config.Portage['make.conf']) + Lines = self.getLines(self.Config['Portage']['make.conf']) - for line in lines: + for line in Lines: if not line.startswith('#'): - if StateBox is 'Null' and not line.endswith('"'): + if StateBox == 'Null' and not line.endswith('"'): StateBox = line.split('=')[0] - MakeConfig[StateBox] = line.split('=')] = [] - for i in line.split('=')] = line.split(" ") + MakeConfig[StateBox] = line.split('=')[1].split(" ") + for i in line.split('=')[1].split(" "): MakeConfig[StateBox].append(i) - elif StateBox is not 'Null' and not line.endswith('"') + elif StateBox != 'Null' and not line.endswith('"'): StateBox ='Null' - for i in line.split('=')] = line.split(" ") - MakeConfig[StateBox].append(i) - elif StateBox is 'Null' and line.endswith('"'): + for i in line.split('=')[1].split(" "): + MakeConfig[StateBox].append(i) + elif StateBox == 'Null' and line.endswith('"'): MakeConfig[StateBox] = line.split(" ") print(MakeConfig) @@ -38,10 +38,9 @@ class PortageConfig(): def parsePackageMasks(self): Lines = self.getlines(self.Config.Portage['package.mask']) - - def def parsePackageKeywords(self): + def parsePackageKeywords(self): Lines = self.getlines(self.Config.Portage['package.keywords']) if __name__ == '__main__': - test = TestConfig() - test.parseMakeConfig() + test = PortageConfig() + test.parseMakeConf() diff --git a/utils/utils.py b/utils/utils.py index b260e71..bf70b81 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -3,7 +3,7 @@ '__autor__' == 'serkus' import os, sys, json from urllib import request -from utils.package import search +from package import search # import xml import xml.etree.ElementTree as ET @@ -164,18 +164,14 @@ def sort_install_pkg(): #print(pkg_name) if pkg_name not in INSTALL: INSTALL[d.replace(path, "").split('/')[0]] = [] - if - INSTALL[d.replace(path,"").split('/')[0]].append(dict(name = pkg_name[:-1], ver = f.replace(pkg_name, ""))) - + if d.replace(path, "").split('/')[0] not in INSTALL: + INSTALL[d.replace(path,"").split('/')[0]].append(dict(name = pkg_name[:-1], ver = f.replace(pkg_name, ""))) else: - INSTALL[d.replace(path, - "").split('/')[0]].append(dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "") - + INSTALL[d.replace(path,"").split('/')[0]].append(dict(name = pkg_name[:-1],ver = f.replace(pkg_name, ""))) if d.replace(path, "").split('/')[0] not in INSTALL: INSTALL[d.replace(path, "").split('/')[0]] = [] INSTALL[d.replace(path, "").split('/')[0]].append(f.replace(".ebuild", "") ) - INSTALL[d.replace(path, - "").split('/')[0]].append(f.replace(".ebuild", "")) #dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "") + INSTALL[d.replace(path,"").split('/')[0]].append(f.replace(".ebuild", "")) #dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "") #print(str(len(INSTALL))) @@ -183,8 +179,8 @@ def sort_install_pkg(): return INSTALL def ScanTreePortage(): DirsRoot = ["/var/db/repos", "/usr/portage"] - d, ListTree, f for in os.walk('/usr/portage') and d, ListTree, f for in os.walk("/var/db/repos") - return ListTree + #d, ListTree, f for in os.walk('/usr/portage') and d, ListTree, f for in os.walk("/var/db/repos") + #return ListTree def scan_config_portage(): Dirs_root = ["/var/db/repos", "/usr/portage"]