Skip to content

Commit

Permalink
use resource plugin support for built-ins re #104
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeifer committed Aug 28, 2022
1 parent 8518a07 commit 75897c1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,7 @@ def git_version(gitdir, default='0.0.0'):
entry_points='''
[console_scripts]
cirrus=cirrus.cli.__main__:main
[cirrus.resources]
built-in=cirrus.builtins
''',
)
3 changes: 0 additions & 3 deletions src/cirrus/core/cloudformation/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,6 @@ def search_dir(path, source=None):
misc.relative_to_cwd(yml),
)

if self.core_dir.is_dir():
yield from search_dir(self.core_dir, source=BUILT_IN)

for plugin_name, plugin_dir in self.plugins.items():
yield from search_dir(plugin_dir, source=plugin_name)

Expand Down
6 changes: 1 addition & 5 deletions src/cirrus/core/components/base/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pathlib import Path

from ..files import ComponentFile, BaseDefinition
from cirrus.core.constants import BUILT_IN
from cirrus.core.exceptions import ComponentError
from cirrus.core.utils.yaml import NamedYamlable
from cirrus.core.utils import misc
Expand All @@ -16,8 +17,6 @@

T = TypeVar('T', bound='Component')

BUILT_IN = 'built-in'


class ComponentMeta(GroupMeta):
def __new__(cls, name, bases, attrs, **kwargs):
Expand Down Expand Up @@ -67,9 +66,6 @@ def from_dir(self, d: Path, name: str=None, source: str=None) -> Type[T]:
continue

def _find(self, name: str=None) -> Type[T]:
if self.core_dir.is_dir():
yield from self.from_dir(self.core_dir, name=name, source='built-in')

for plugin_name, plugin_dir in self.plugins.items():
yield from self.from_dir(plugin_dir, name=name, source=plugin_name)

Expand Down
2 changes: 2 additions & 0 deletions src/cirrus/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
'serverless-step-functions': '~3.7.0',
'serverless-iam-roles-per-function': '~3.2.0',
}

BUILT_IN = 'built-in'
4 changes: 0 additions & 4 deletions src/cirrus/core/group_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ def __new__(cls, name, bases, attrs, **kwargs):
elif 'user_dir_name' not in attrs or attrs['user_dir_name'] is None:
attrs['user_dir_name'] = attrs['group_name']

attrs['core_dir'] = Path(cirrus.builtins.__file__).parent.joinpath(
attrs['group_name']
)

attrs['_plugins'] = None
attrs['_elements'] = None
attrs['project'] = None
Expand Down

0 comments on commit 75897c1

Please sign in to comment.