Exemplo n.º 1
0
def init_package():
    """
    Call to initialise the package, other than configuration file (and logging set up).
    :return:
    """
    global PlatformConfiguration, PlatformWrappedConfiguration
    try:
        # It would be good to log the loading of configuration information, except that the logging
        # configuration is loaded in this step!
        # Try to load configuration silently...
        PlatformConfiguration, PlatformWrappedConfiguration = \
            econ_platform_core.configuration.load_platform_configuration(display_steps=True)
    except:
        raise
        # it failed, so try again, showing the steps...
        # PlatformConfiguration = econ_platform_core.configuration.load_platform_configuration(display_steps=True)
    # By default, go into the "logs" directory below this file.
    if len(LogInfo.LogDirectory) == 0:
        # If it has not been set manually, use the config information.
        LogInfo.LogDirectory = utils.parse_config_path(
            PlatformConfiguration['Logging']['LogDirectory'])
    Databases.Initialise()
    Providers.Initialise()
    UpdateProtocolList.Initialise()
    global LoadedExtensions
    global FailedExtensions
    global DecoratedFailedExtensions
    LoadedExtensions, FailedExtensions, DecoratedFailedExtensions = econ_platform_core.extensions.load_extensions(
    )
Exemplo n.º 2
0
def init_package():
    """
    Call to initialise the package, other than configuration file (and logging set up).
    :return:
    """
    global PlatformConfiguration
    if not PlatformConfiguration.LoadedAny:
        # May switch over to "silent" loading, but not knowing which config files were loaded can
        # cause a lot of errors...
        PlatformConfiguration = econ_platform_core.configuration.load_platform_configuration(
            display_steps=True)
    # By default, go into the "logs" directory below this file.
    if len(LogInfo.LogDirectory) == 0:
        # If it has not been set manually, use the config information.
        LogInfo.LogDirectory = utils.parse_config_path(
            PlatformConfiguration['Logging']['LogDirectory'])
    Databases.Initialise()
    Providers.Initialise()
    UpdateProtocolList.Initialise()
    # Replace this with an "extension manager"
    global LoadedExtensions
    global FailedExtensions
    global DecoratedFailedExtensions
    LoadedExtensions, FailedExtensions, DecoratedFailedExtensions = econ_platform_core.extensions.load_extensions(
    )
Exemplo n.º 3
0
 def test_sep3(self):
     self.assertEqual(
         os.path.join(test_parse_config_directory.package_dir, 'data'),
         utils.parse_config_path('{DATA}'))
Exemplo n.º 4
0
 def test_sep2(self):
     self.assertEqual(
         os.path.join(test_parse_config_directory.package_dir, 'foo'),
         utils.parse_config_path('{CORE}/foo'))
Exemplo n.º 5
0
 def test_without_sep(self):
     self.assertEqual(test_parse_config_directory.package_dir,
                      utils.parse_config_path('{CORE}'))
Exemplo n.º 6
0
 def test_case_sensitive(self):
     self.assertEqual('{base}', utils.parse_config_path('{base}'))
Exemplo n.º 7
0
 def test_custom(self):
     self.assertEqual('foo', utils.parse_config_path('foo'))