You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.5 KiB

#-*- codding:UTF-8 -*-
#!/usr/bin/env python
import os, sys, json
from utils import load_config
class PortageConfig():
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={}
def parseMakeConf(self):
StateBox = 'Null'
with open (Config.Portage['make.conf'], 'r') as f:
lines = f.read().split("\n")
for line in lines:
if not line.startswith('#'):
if StateBox is 'Null' and not line.endswith('"'):
StateBox = line.split('=')[0]
MakeConfig[StateBox] = 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)
elif StateBox is 'Null' and line.endswith('"'):
MakeConfig[StateBox] = line.split(" ")
print(MakeConfig)
def parsePackageUse(self):
pass
def parsePackageMaskself(self):
pass
def def parsePackageKeywords(self):
pass
if __name__ == '__main__':
test = TestConfig()
test.parseMakeConfig()