diff --git a/abf.py b/abf.py index 7abb597..ee081bd 100755 --- a/abf.py +++ b/abf.py @@ -23,12 +23,9 @@ gettext.install('abf-console-client') from abf.console.config import Config, mkdirs from abf.console.log import Log -log = Log('abf') - -from abf.console.misc import * -from abf.api.exceptions import * from abf.model import * + configs_dir = '/etc/abf/mock-urpm/configs/' def test(): @@ -1705,14 +1702,18 @@ def clean(): if __name__ == '__main__': global projects_cfg - global cfg parse_command_line() if command_line.config: - cfg = Config(command_line.config) + cfg = Config(conf_path=command_line.config) + log = Log('abf', conf_path=command_line.config) else: cfg = Config() + log = Log('abf') + + from abf.console.misc import * + from abf.api.exceptions import * abf_url = cfg['main']['abf_url'] file_store_url = cfg['main']['file_store_url'] diff --git a/abf/console/log.py b/abf/console/log.py index d9f4c2b..e6d1c6e 100644 --- a/abf/console/log.py +++ b/abf/console/log.py @@ -23,8 +23,8 @@ class Log: Log.set_verbose() logging.getLogger("").handlers[0].setLevel(logging.CRITICAL) - def __init__(self, name=''): - logging.config.fileConfig(os.path.expanduser('~/.abfcfg')) + def __init__(self, name='', conf_path='~/.abfcfg'): + logging.config.fileConfig(os.path.expanduser(conf_path)) self.log = logging.getLogger(name) def __getattr__(self, attr): diff --git a/abf/console/misc.py b/abf/console/misc.py index a60e0c4..0571338 100644 --- a/abf/console/misc.py +++ b/abf/console/misc.py @@ -16,6 +16,7 @@ import urllib2 from abf.console.log import Log from abf.api.exceptions import * + log = Log('models') def mkdirs(path): @@ -348,7 +349,6 @@ def pack_project(root_path): shutil.rmtree(f) - def execute_command(command, shell=False, cwd=None, timeout=0, raiseExc=True, print_to_stdout=False, exit_on_error=False, env=[]): output = "" start = time.time() diff --git a/abf/model.py b/abf/model.py index 7873edc..51e5420 100644 --- a/abf/model.py +++ b/abf/model.py @@ -7,16 +7,12 @@ import string from datetime import datetime from abf.api.exceptions import * -#from abf.api.html import * from abf.api.jsn import * - log = logging.getLogger('models') lt_cache = Cache('abf', expire = 86400, type='file', data_dir='/tmp/abf_cache/data', lock_dir='/tmp/abf_cache/data') st_cache = Cache('abf', expire = 3600, type='file', data_dir='/tmp/abf_cache/data', lock_dir='/tmp/abf_cache/data') -#lt_cache = None -#st_cache = None def get_cached(cache, cache_key, func, *args, **kwargs): if cache and cache.has_key(cache_key):