-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_parser.py
More file actions
27 lines (19 loc) · 791 Bytes
/
config_parser.py
File metadata and controls
27 lines (19 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import configparser, os
#config_path = os.path.join(os.path.dirname(__file__),'config.ini')
class ConfigParser:
def __init__(self, path):
self.config_path = path
if not os.path.isfile(self.config_path):
raise Exception('No config.ini at {0}!'.format(self.config_path))
self.config = configparser.ConfigParser()
self.config.read(self.config_path)
def get(self, property):
return self.config.get('app_source',property)
def getSection(self, section):
list = self.config.items(section)
return [item[1] for item in list]
def getLibSourceFiles(self, lib):
files = self.config.get('libraries', lib)
if files == 'None':
return []
return files.replace(' ', '').split(',')