예제 #1
0
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)
예제 #2
0
 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))
예제 #3
0
 def test_returns_None_when_package_not_found(self):
     import os.path
     self.assertEquals(
         None,
         find_package_by_module(os.path))
예제 #4
0
 def test_finds_package_by_main_module(self):
     import ftw.autofeature
     self.assertEquals(
         u'ftw.autofeature',
         find_package_by_module(ftw.autofeature))