From c46d8da153ac658c8bd145376e22b1218db1090a Mon Sep 17 00:00:00 2001 From: kali Date: Sun, 22 Jul 2012 21:10:15 -0700 Subject: initial import --- src/leap/baseapp/config.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/leap/baseapp/config.py (limited to 'src/leap/baseapp/config.py') diff --git a/src/leap/baseapp/config.py b/src/leap/baseapp/config.py new file mode 100644 index 00000000..efdb4726 --- /dev/null +++ b/src/leap/baseapp/config.py @@ -0,0 +1,40 @@ +import ConfigParser +import os + + +def get_config(config_file=None): + """ + temporary method for getting configs, + mainly for early stage development process. + in the future we will get preferences + from the storage api + """ + config = ConfigParser.ConfigParser() + #config.readfp(open('defaults.cfg')) + #XXX does this work on win / mac also??? + conf_path_list = ['eip.cfg', # XXX build a + # proper path with platform-specific places + # XXX make .config/foo + os.path.expanduser('~/.eip.cfg')] + if config_file: + config.readfp(config_file) + else: + config.read(conf_path_list) + return config + + +# XXX wrapper around config? to get default values + +def get_with_defaults(config, section, option): + if config.has_option(section, option): + return config.get(section, option) + else: + # XXX lookup in defaults dict??? + pass + + +def get_vpn_stdout_mockup(): + command = "python" + args = ["-u", "-c", "from eip_client import fakeclient;\ +fakeclient.write_output()"] + return command, args -- cgit v1.2.3