def declare_extras_features(context): LOG.debug('declaring extras for {0}'.format(context.info)) package_name = find_package_by_module(context.package) extras = find_extras_by_package(package_name) LOG.debug('extras for {}: {}'.format(package_name, extras)) installed_extras = [name for (name, dependencies) in extras.items() if all_packages_installed(dependencies)] for postfix in combine_features(installed_extras): feature_name = '{}:{}'.format(package_name, postfix) LOG.debug('declaring feature {}'.format(feature_name)) context.provideFeature(feature_name)
def test_finds_package_by_a_submodule(self): import ftw.autofeature.tests.test_utils self.assertEquals( u'ftw.autofeature', find_package_by_module(ftw.autofeature.tests.test_utils))
def test_returns_None_when_package_not_found(self): import os.path self.assertEquals( None, find_package_by_module(os.path))
def test_finds_package_by_main_module(self): import ftw.autofeature self.assertEquals( u'ftw.autofeature', find_package_by_module(ftw.autofeature))