Added workaround for issue affecting namespace plugins introduced by setuptools 31.0.0
Change-Id: I510ce520e362ad10de93e2defb83429520acd140
This commit is contained in:
parent
af90c22808
commit
b53ad3f0b1
@ -610,13 +610,30 @@ class EngineConfigManager(object):
|
|||||||
|
|
||||||
|
|
||||||
class EnginePluginManager(object):
|
class EnginePluginManager(object):
|
||||||
_PLUGIN_DIR = os.path.join(os.path.dirname(cafe.__file__), 'plugins')
|
|
||||||
|
@classmethod
|
||||||
|
def _plugin_dir(cls):
|
||||||
|
"""
|
||||||
|
TODO: setuptools 31.0.0 introduced a bug that results in __file__
|
||||||
|
not existing for a namespace packages, in our case,
|
||||||
|
after installing a namespace package in it.
|
||||||
|
This is a workaround/hack to get around the issue for now.
|
||||||
|
Ideally, we should move all the plugins into pypi so that we
|
||||||
|
don't have to install them from a local directory like this.
|
||||||
|
"""
|
||||||
|
cafe_path = None
|
||||||
|
try:
|
||||||
|
cafe_path = os.path.join(os.path.dirname(cafe.__file__), 'plugins')
|
||||||
|
except AttributeError:
|
||||||
|
cafe_path = os.path.join(cafe.__path__[0], 'plugins')
|
||||||
|
|
||||||
|
return cafe_path
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def list_plugins(cls):
|
def list_plugins(cls):
|
||||||
""" Lists all plugins currently available in user's .opencafe cache"""
|
""" Lists all plugins currently available in user's .opencafe cache"""
|
||||||
|
|
||||||
plugin_folders = os.walk(cls._PLUGIN_DIR).next()[1]
|
plugin_folders = os.walk(cls._plugin_dir()).next()[1]
|
||||||
wrap = textwrap.TextWrapper(initial_indent=" ",
|
wrap = textwrap.TextWrapper(initial_indent=" ",
|
||||||
subsequent_indent=" ",
|
subsequent_indent=" ",
|
||||||
break_long_words=False).fill
|
break_long_words=False).fill
|
||||||
@ -637,7 +654,7 @@ class EnginePluginManager(object):
|
|||||||
def install_plugin(cls, plugin_name):
|
def install_plugin(cls, plugin_name):
|
||||||
""" Install a single plugin by name into the current environment"""
|
""" Install a single plugin by name into the current environment"""
|
||||||
|
|
||||||
plugin_dir = os.path.join(cls._PLUGIN_DIR, plugin_name)
|
plugin_dir = os.path.join(cls._plugin_dir(), plugin_name)
|
||||||
wrap = textwrap.TextWrapper(initial_indent=" ",
|
wrap = textwrap.TextWrapper(initial_indent=" ",
|
||||||
subsequent_indent=" ",
|
subsequent_indent=" ",
|
||||||
break_long_words=False).fill
|
break_long_words=False).fill
|
||||||
|
2
setup.py
2
setup.py
@ -55,7 +55,7 @@ setup(
|
|||||||
author='CafeHub',
|
author='CafeHub',
|
||||||
author_email='cloud-cafe@lists.rackspace.com',
|
author_email='cloud-cafe@lists.rackspace.com',
|
||||||
url='http://opencafe.readthedocs.org',
|
url='http://opencafe.readthedocs.org',
|
||||||
install_requires=['six'],
|
install_requires=['six', "setuptools<=30.0.0"],
|
||||||
packages=find_packages(exclude=('tests*', 'docs')),
|
packages=find_packages(exclude=('tests*', 'docs')),
|
||||||
package_data={'cafe': plugins},
|
package_data={'cafe': plugins},
|
||||||
license=open('LICENSE').read(),
|
license=open('LICENSE').read(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user