fix make.conf #3

master
serkus01 2 years ago
parent b89ef5d21f
commit 62dfdd2ad3

@ -5,6 +5,6 @@
"THEME": "default" "THEME": "default"
}, },
"Portage":{ "Portage":{
"make.conf":"/etc/portge/make.conf/custom" "make.conf":"/etc/portage/make.conf/custom"
} }
} }

@ -15,20 +15,20 @@ class PortageConfig():
def parseMakeConf(self): def parseMakeConf(self):
StateBox = 'Null' 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 not line.startswith('#'):
if StateBox is 'Null' and not line.endswith('"'): if StateBox == 'Null' and not line.endswith('"'):
StateBox = line.split('=')[0] StateBox = line.split('=')[0]
MakeConfig[StateBox] = line.split('=')] = [] MakeConfig[StateBox] = line.split('=')[1].split(" ")
for i in line.split('=')] = line.split(" ") for i in line.split('=')[1].split(" "):
MakeConfig[StateBox].append(i) MakeConfig[StateBox].append(i)
elif StateBox is not 'Null' and not line.endswith('"') elif StateBox != 'Null' and not line.endswith('"'):
StateBox ='Null' StateBox ='Null'
for i in line.split('=')] = line.split(" ") for i in line.split('=')[1].split(" "):
MakeConfig[StateBox].append(i) MakeConfig[StateBox].append(i)
elif StateBox is 'Null' and line.endswith('"'): elif StateBox == 'Null' and line.endswith('"'):
MakeConfig[StateBox] = line.split(" ") MakeConfig[StateBox] = line.split(" ")
print(MakeConfig) print(MakeConfig)
@ -38,10 +38,9 @@ class PortageConfig():
def parsePackageMasks(self): def parsePackageMasks(self):
Lines = self.getlines(self.Config.Portage['package.mask']) Lines = self.getlines(self.Config.Portage['package.mask'])
def parsePackageKeywords(self):
def def parsePackageKeywords(self):
Lines = self.getlines(self.Config.Portage['package.keywords']) Lines = self.getlines(self.Config.Portage['package.keywords'])
if __name__ == '__main__': if __name__ == '__main__':
test = TestConfig() test = PortageConfig()
test.parseMakeConfig() test.parseMakeConf()

@ -3,7 +3,7 @@
'__autor__' == 'serkus' '__autor__' == 'serkus'
import os, sys, json import os, sys, json
from urllib import request from urllib import request
from utils.package import search from package import search
# import xml # import xml
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
@ -164,18 +164,14 @@ def sort_install_pkg():
#print(pkg_name) #print(pkg_name)
if pkg_name not in INSTALL: if pkg_name not in INSTALL:
INSTALL[d.replace(path, "").split('/')[0]] = [] INSTALL[d.replace(path, "").split('/')[0]] = []
if 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, ""))) INSTALL[d.replace(path,"").split('/')[0]].append(dict(name = pkg_name[:-1], ver = f.replace(pkg_name, "")))
else: else:
INSTALL[d.replace(path, INSTALL[d.replace(path,"").split('/')[0]].append(dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "")))
"").split('/')[0]].append(dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "")
if d.replace(path, "").split('/')[0] not in INSTALL: if d.replace(path, "").split('/')[0] not in INSTALL:
INSTALL[d.replace(path, "").split('/')[0]] = [] 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", "") )
INSTALL[d.replace(path, INSTALL[d.replace(path,"").split('/')[0]].append(f.replace(".ebuild", "")) #dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "")
"").split('/')[0]].append(f.replace(".ebuild", "")) #dict(name = pkg_name[:-1],ver = f.replace(pkg_name, "")
#print(str(len(INSTALL))) #print(str(len(INSTALL)))
@ -183,8 +179,8 @@ def sort_install_pkg():
return INSTALL return INSTALL
def ScanTreePortage(): def ScanTreePortage():
DirsRoot = ["/var/db/repos", "/usr/portage"] 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") #d, ListTree, f for in os.walk('/usr/portage') and d, ListTree, f for in os.walk("/var/db/repos")
return ListTree #return ListTree
def scan_config_portage(): def scan_config_portage():
Dirs_root = ["/var/db/repos", "/usr/portage"] Dirs_root = ["/var/db/repos", "/usr/portage"]

Loading…
Cancel
Save