parent
2d35ec6eb0
commit
c097670d6c
@ -1,43 +1,42 @@
|
|||||||
#-*- codding:UTF-8 -*-
|
#-*- codding:UTF-8 -*-
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import os, sys, json
|
import os, sys, json
|
||||||
from utils import load_config
|
from utils import load_config
|
||||||
def parseMakeConf():
|
class PortageConfig():
|
||||||
Config = load_config()
|
def __init__(self):
|
||||||
|
self.Config = load_config()
|
||||||
|
self.TargetParse =['USE', 'USE_EXPAN', 'VIDEO_CARDS', 'ACCEPT_CHOSTS', 'ACCEPT_LICENSE','CCACHE_DIR', 'CCACHE_SIZE',
|
||||||
|
'EMERGE_DEFAULT_OPTS', 'CFLAGS', 'CXXFLAGS', 'MAKEOPTS']
|
||||||
|
self.MakeConfig={}
|
||||||
|
|
||||||
TargetParse =['USE', 'USE_EXPAN', 'VIDEO_CARDS', 'ACCEPT_CHOSTS', 'ACCEPT_LICENSE','CCACHE_DIR', 'CCACHE_SIZE',
|
def parseMakeConf(self):
|
||||||
'EMERGE_DEFAULT_OPTS', 'CFLAGS', 'CXXFLAGS', 'MAKEOPTS']
|
StateBox = 'Null'
|
||||||
|
with open (Config.Portage['make.conf'], 'r') as f:
|
||||||
StateBox = 'Null'
|
lines = f.read().split("\n")
|
||||||
MakeConfig={}
|
|
||||||
with open (Config.Portage['make.conf'], 'r') as f:
|
|
||||||
lines = f.read().split("\n")
|
|
||||||
|
|
||||||
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 is 'Null' and not line.endswith('"'):
|
||||||
StateBox = line.split('=')[0]
|
StateBox = line.split('=')[0]
|
||||||
MakeConfig[StateBox] = line.split('=')] = []
|
MakeConfig[StateBox] = line.split('=')] = []
|
||||||
for i in line.split('=')] = line.split(" ")
|
for i in line.split('=')] = line.split(" ")
|
||||||
|
MakeConfig[StateBox].append(i)
|
||||||
|
elif StateBox is not 'Null' and not line.endswith('"')
|
||||||
|
StateBox ='Null'
|
||||||
|
for i in line.split('=')] = line.split(" ")
|
||||||
MakeConfig[StateBox].append(i)
|
MakeConfig[StateBox].append(i)
|
||||||
elif StateBox is not 'Null' and not line.endswith('"')
|
elif StateBox is 'Null' and line.endswith('"'):
|
||||||
StateBox ='Null'
|
MakeConfig[StateBox] = line.split(" ")
|
||||||
for i in line.split('=')] = line.split(" ")
|
|
||||||
MakeConfig[StateBox].append(i)
|
print(MakeConfig)
|
||||||
elif StateBox is 'Null' and line.endswith('"'):
|
|
||||||
MakeConfig[StateBox] = line.split(" ")
|
|
||||||
|
|
||||||
print(MakeConfig)
|
|
||||||
|
|
||||||
def parsePackageUse():
|
def parsePackageUse(self):
|
||||||
with open (Config.Portage['package.use'], 'r') as f:
|
pass
|
||||||
lines = f.read().split("\n")
|
def parsePackageMaskself(self):
|
||||||
def parsePackageMask():
|
pass
|
||||||
with open (Config.Portage['package.mask'], 'r') as f:
|
def def parsePackageKeywords(self):
|
||||||
lines = f.read().split("\n")
|
pass
|
||||||
def def parsePackageKeywords():
|
|
||||||
with open (Config.Portage['package.keywords'], 'r') as f:
|
|
||||||
lines = f.read().split("\n")
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parseMakeConfig()
|
test = TestConfig()
|
||||||
|
test.parseMakeConfig()
|
||||||
|
Loading…
Reference in new issue