pull in win

master
serkus 2 years ago
commit c6f6e9ce43

@ -4,8 +4,16 @@ run:
#make cert && #make cert &&
python server.py python server.py
testToken: testToken:
python core/jwt.py python core/jwt.py
cert: cert:
openssl req -new -x509 -keyout localhost.pem -out localhost.pem -nodes -days 365 openssl req -new -x509 -keyout localhost.pem -out localhost.pem -nodes -days 365
testEnv:
python utils/parsePortage.py envMake
testEnvUse:
python utils/parsePortage.py use

@ -5,6 +5,12 @@
"THEME": "default" "THEME": "default"
}, },
"Portage":{ "Portage":{
"make.conf":"/etc/portge/make.conf/custom" "rootPth":"/etc/portage",
"make.conf":"/etc/portage/make.conf/custom",
"package.use":"/etc/portage/package.use/custom",
"package.accept_keywords":"/etc/portage/package.accept_keywords/custom",
"package.mask":"/etc/portage/package.mask",
"package.unmask":"/etc/portage/package.unmask/custom"
} }
} }

@ -8,35 +8,63 @@ class PortageConfig():
self.TargetParse =['USE', 'USE_EXPAN', 'VIDEO_CARDS', 'ACCEPT_CHOSTS', 'ACCEPT_LICENSE','CCACHE_DIR', 'CCACHE_SIZE', self.TargetParse =['USE', 'USE_EXPAN', 'VIDEO_CARDS', 'ACCEPT_CHOSTS', 'ACCEPT_LICENSE','CCACHE_DIR', 'CCACHE_SIZE',
'EMERGE_DEFAULT_OPTS', 'CFLAGS', 'CXXFLAGS', 'MAKEOPTS'] 'EMERGE_DEFAULT_OPTS', 'CFLAGS', 'CXXFLAGS', 'MAKEOPTS']
self.MakeConfig={} self.MakeConfig={}
def getLines(self, filename):
if os.path.exists(filename):
with open (filename, 'r') as f:
lines = f.read().split("\n")
else:
print("path is not Found")
return lines
def parseMakeConf(self): def parseMakeConf(self):
StateBox = 'Null' StateBox = 'Null'
with open (Config.Portage['make.conf'], 'r') as f: Lines = self.getLines(self.Config['Portage']['make.conf'])
lines = f.read().split("\n")
for line in lines: for line in Lines:
if not line.startswith('#'): if not line.startswith('#') and len(line.split("="))>1:
if StateBox is 'Null' and not line.endswith('"'): line.replace('"', "")
StateBox = line.split('=')[0] if StateBox == 'Null' and not line.endswith('"'):
MakeConfig[StateBox] = line.split('=')] = [] StateBox = line.split('=')[0]
for i in line.split('=')] = line.split(" ") self.MakeConfig[StateBox] =[]
MakeConfig[StateBox].append(i)
elif StateBox is not 'Null' and not line.endswith('"') self.MakeConfig[StateBox] = line.split('=')[1].split(" ")
StateBox ='Null' for i in line.split('=')[1].split(" "):
for i in line.split('=')] = line.split(" ") self.MakeConfig[split('=')[0]].append(i)
MakeConfig[StateBox].append(i) elif StateBox !='Null' and not line.endswith('"'):
elif StateBox is 'Null' and line.endswith('"'): StateBox = line.split('=')[1]
MakeConfig[StateBox] = line.split(" ") for i in line.split('=')[1].split(" "):
self.MakeConfig[line.split('=')[0]].append(i)
elif StateBox == 'Null' and line.endswith('"'):
#line.replace('"', "")
self.MakeConfig[line.split('=')[0]] = line.split('="')[1].split(" ")
print(MakeConfig) print(self.MakeConfig)
def parsePackageUse(self): def parsePackageUse(self):
pass self.MakeConfig['package.use'] =[]
def parsePackageMaskself(self): Lines = self.getLines(self.Config['Portage']['package.use'])
pass for i in Lines:
def def parsePackageKeywords(self): self.MakeConfig['package.use'].append(dict(Name=i.split(" ")[0], Uses=i.split(" ")[1:]))
pass
def parsePackageMasks(self):
Lines = self.getLines(self.Config['Portage']['package.mask'])
def parsePakageUnmask(self):
Lines = self.getLines(self.Config['Portage']["package.unmask"])
def parsePackageKeywords(self):
Lines = self.getLines(self.Config['Portage']['package.accept_keywords'])
if __name__ == '__main__': if __name__ == '__main__':
<<<<<<< HEAD
test = TestConfig() test = TestConfig()
test.parseMakeConfig() test.parseMakeConfig()
=======
Test = PortageConfig()
if sys.argv[1] == "envMake":
Test.parseMakeConf()
elif sys.argv[1] == "use":
Test.parsePackageUse()
else:
Test.parseMakeConf()
>>>>>>> c4fbeaac94287a55325443257d1508c4141f2a34

@ -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