|
|
@ -1,5 +1,4 @@
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import copy
|
|
|
|
|
|
|
|
from .p3 import configparser
|
|
|
|
from .p3 import configparser
|
|
|
|
|
|
|
|
|
|
|
|
# constant stuff (DFT = DEFAULT)
|
|
|
|
# constant stuff (DFT = DEFAULT)
|
|
|
@ -32,12 +31,15 @@ BOOLEANS = {'import_copy', 'import_move', 'color', 'version_warning'}
|
|
|
|
# package-shared config that can be accessed using :
|
|
|
|
# package-shared config that can be accessed using :
|
|
|
|
# from configs import config
|
|
|
|
# from configs import config
|
|
|
|
_config = None
|
|
|
|
_config = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def config(section=MAIN_SECTION):
|
|
|
|
def config(section=MAIN_SECTION):
|
|
|
|
if _config is None:
|
|
|
|
if _config is None:
|
|
|
|
raise ValueError('not config instanciated yet')
|
|
|
|
raise ValueError('not config instanciated yet')
|
|
|
|
_config._section = section
|
|
|
|
_config._section = section
|
|
|
|
return _config
|
|
|
|
return _config
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Config(object):
|
|
|
|
class Config(object):
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, **kwargs):
|
|
|
|
def __init__(self, **kwargs):
|
|
|
@ -89,5 +91,6 @@ class Config(object):
|
|
|
|
value = str2bool(value)
|
|
|
|
value = str2bool(value)
|
|
|
|
yield name, value
|
|
|
|
yield name, value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def str2bool(s):
|
|
|
|
def str2bool(s):
|
|
|
|
return str(s).lower() in ('yes', 'true', 't', 'y', '1')
|
|
|
|
return str(s).lower() in ('yes', 'true', 't', 'y', '1')
|
|
|
|