Example #1
0
def get_bundle_from_path(path, bundle_directory, package):
    '''
    This method tries to instance every bundle using the given directory. When
    a bundle is able to identify the files present in the directory the instance
    of that bundle is returned to the caller.
    '''
    LOGGER.debug('Path: %s will be processed.', path)
    bundles = find_in_dir(relative_path(__file__, bundle_directory), get_last_package_from_name(package))
    for bundle_name in bundles:
        bundle = load_bundle(bundle_name, path, package)
        if bundle.can_identify():
            return bundle
        else:
            LOGGER.info('Directory %s is not a %s bundle.', path, bundle.get_name())
    return None
Example #2
0
def get_bundle_from_path(path, bundle_directory, package):
    '''
    This method tries to instance every bundle using the given directory. When
    a bundle is able to identify the files present in the directory the instance
    of that bundle is returned to the caller.
    '''
    LOGGER.debug('Path: %s will be processed.', path)
    bundles = find_in_dir(relative_path(__file__, bundle_directory),
                          get_last_package_from_name(package))
    for bundle_name in bundles:
        bundle = load_bundle(bundle_name, path, package)
        if bundle.can_identify():
            return bundle
        else:
            LOGGER.info('Directory %s is not a %s bundle.', path,
                        bundle.get_name())
    return None
Example #3
0
 def test_get_last_package_from_name(self):
     self.assertEqual(get_last_package_from_name('name.for.package'), 'package')
Example #4
0
 def test_get_last_package_from_name(self):
     self.assertEqual(get_last_package_from_name('name.for.package'),
                      'package')