Example #1
0
 def read(self, filenames=None):
     # Load FI config
     with open(utils.fixpath(self.fi_config)) as fi_config:
         self.read_file(fi_config)
     # Then load user configs (defaults to fi.cfg [global] config: value)
     filenames = filenames or utils.fixpath(self.get("global", "config"))
     return ConfigParser.read(self, filenames)
Example #2
0
 def test_all(self):
     """
     utils.fixpath() calls os.path.{expanduser, normpath, normcase, abspath}
     """
     test_path = "~/foo/../bar"
     home = os.environ["HOME"]
     self.assertEqual(fixpath(test_path), "{}/bar".format(home))
Example #3
0
 def test_all(self):
     """
     utils.fixpath() calls os.path.{expanduser, normpath, normcase, abspath}
     """
     test_path = "~/foo/../bar"
     home = os.environ["HOME"]
     self.assertEqual(fixpath(test_path), "{}/bar".format(home))
Example #4
0
 def read(self, filenames=None):
     # Load FI config
     self.readfp(open(fixpath(self.fi_config)))
     # Then load user configs (defaults to fi.cfg [global] config: value)
     filenames = filenames or fixpath(self.get('global', 'config'))
     return SafeConfigParser.read(self, filenames)
Example #5
0
 def read(self, filenames=None):
     # Load FI config
     self.readfp(open(fixpath(self.fi_config)))
     # Then load user configs (defaults to fi.cfg [global] config: value)
     filenames = filenames or fixpath(self.get('global', 'config'))
     return SafeConfigParser.read(self, filenames)
Example #6
0
# coding: utf-8
# stdlib imports
import os

# local imports
from ofxtools import utils

__all__ = ["CONFIGDIR", "USERCONFIGDIR"]


CONFIGDIR = utils.fixpath(os.path.dirname(__file__))


# Cross-platform specification of user configuration directory
if "APPDATA" in os.environ:  # Windows
    CONFIGHOME = os.environ["APPDATA"]
elif "XDG_CONFIG_HOME" in os.environ:  # Linux
    CONFIGHOME = os.environ["XDG_CONFIG_HOME"]
else:
    CONFIGHOME = os.path.join(os.environ["HOME"], ".config")


USERCONFIGDIR = os.path.join(utils.fixpath(CONFIGHOME), "ofxtools")