Skip to content

Commit

Permalink
Revert "Preparations for blueprint support (#3265)" (#3331)
Browse files Browse the repository at this point in the history
This reverts commit 000c663.
  • Loading branch information
ludeeus authored Nov 17, 2023
1 parent 38f136e commit 8f0c7cf
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 134 deletions.
1 change: 0 additions & 1 deletion action/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

CATEGORIES = [
"appdaemon",
"blueprint",
"integration",
"netdaemon",
"plugin",
Expand Down
8 changes: 0 additions & 8 deletions custom_components/hacs/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,8 @@ class HacsGitHubRepo(StrEnum):
INTEGRATION = "hacs/integration"


class BlueprintType(StrEnum):
"""Blueprint types."""

AUTOMATION = "automation"
SCRIPT = "script"


class HacsCategory(StrEnum):
APPDAEMON = "appdaemon"
BLUEPRINT = "blueprint"
INTEGRATION = "integration"
LOVELACE = "lovelace"
PLUGIN = "plugin" # Kept for legacy purposes
Expand Down
2 changes: 0 additions & 2 deletions custom_components/hacs/repositories/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from ..enums import HacsCategory
from .appdaemon import HacsAppdaemonRepository
from .base import HacsRepository
from .blueprint import HacsBlueprintRepository
from .integration import HacsIntegrationRepository
from .netdaemon import HacsNetdaemonRepository
from .plugin import HacsPluginRepository
Expand All @@ -20,5 +19,4 @@
HacsCategory.NETDAEMON: HacsNetdaemonRepository,
HacsCategory.PLUGIN: HacsPluginRepository,
HacsCategory.TEMPLATE: HacsTemplateRepository,
HacsCategory.BLUEPRINT: HacsBlueprintRepository,
}
14 changes: 1 addition & 13 deletions custom_components/hacs/repositories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
"app",
"appdaemon-apps",
"appdaemon",
"blueprint",
"blueprints",
"custom-card",
"custom-cards",
"custom-component",
Expand Down Expand Up @@ -217,7 +215,6 @@ def update_data(self, data: dict, action: bool = False) -> None:
class HacsManifest:
"""HacsManifest class."""

blueprint_type: str = None
content_in_root: bool = False
country: list[str] = []
filename: str = None
Expand Down Expand Up @@ -329,13 +326,6 @@ def string(self) -> str:
"""Return a string representation of the repository."""
return f"<{self.data.category.title()} {self.data.full_name}>"

@property
def repository_owner(self) -> str | None:
"""Return the owner of the repository."""
if not self.data.full_name:
return None
return self.data.full_name.split("/")[0].lower()

@property
def display_name(self) -> str:
"""Return display name."""
Expand Down Expand Up @@ -873,8 +863,6 @@ async def remove_local_directory(self) -> None:
local_path = f"{self.content.path.local}/{self.data.name}.py"
elif self.data.category == "template":
local_path = f"{self.content.path.local}/{self.data.file_name}"
elif self.data.category == "blueprint":
local_path = f"{self.content.path.local}/{self.data.file_name}"
elif self.data.category == "theme":
path = (
f"{self.hacs.core.config_path}/"
Expand Down Expand Up @@ -902,7 +890,7 @@ async def remove_local_directory(self) -> None:
return False
self.logger.debug("%s Removing %s", self.string, local_path)

if self.data.category in ["python_script", "template", "blueprint"]:
if self.data.category in ["python_script", "template"]:
os.remove(local_path)
else:
shutil.rmtree(local_path)
Expand Down
91 changes: 0 additions & 91 deletions custom_components/hacs/repositories/blueprint.py

This file was deleted.

5 changes: 0 additions & 5 deletions custom_components/hacs/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,6 @@ async def async_release_notes(self) -> str | None:
"\n\n<ha-alert alert-type='warning'>You need to manually"
" clear the frontend cache after updating.</ha-alert>\n\n"
)
if self.repository.data.category == HacsCategory.BLUEPRINT:
release_notes += (
"\n\n<ha-alert alert-type='warning'>You need to manually"
" reload and adjust automations after updating.</ha-alert>\n\n"
)

return release_notes.replace("\n#", "\n\n#")

Expand Down
1 change: 0 additions & 1 deletion custom_components/hacs/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

EXPORTED_REPOSITORY_DATA = EXPORTED_BASE_DATA + (
("authors", []),
("blueprint_type", None),
("category", ""),
("description", ""),
("domain", None),
Expand Down
3 changes: 0 additions & 3 deletions custom_components/hacs/utils/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,4 @@ def is_safe(hacs: HacsBase, path: str | Path) -> bool:
Path(f"{hacs.core.config_path}/{hacs.configuration.theme_path}").as_posix(),
Path(f"{hacs.core.config_path}/custom_components/").as_posix(),
Path(f"{hacs.core.config_path}/custom_templates/").as_posix(),
Path(f"{hacs.core.config_path}/blueprints/").as_posix(),
Path(f"{hacs.core.config_path}/blueprints/automation/").as_posix(),
Path(f"{hacs.core.config_path}/blueprints/script/").as_posix(),
)
2 changes: 0 additions & 2 deletions custom_components/hacs/utils/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import voluptuous as vol

from ..const import LOCALE
from ..enums import BlueprintType


@dataclass
Expand Down Expand Up @@ -43,7 +42,6 @@ def _country_validator(values) -> list[str]:

HACS_MANIFEST_JSON_SCHEMA = vol.Schema(
{
vol.Optional("blueprint_type"): vol.Coerce(BlueprintType),
vol.Optional("content_in_root"): bool,
vol.Optional("country"): _country_validator,
vol.Optional("filename"): str,
Expand Down
8 changes: 0 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from custom_components.hacs.const import DOMAIN
from custom_components.hacs.repositories import (
HacsAppdaemonRepository,
HacsBlueprintRepository,
HacsIntegrationRepository,
HacsNetdaemonRepository,
HacsPluginRepository,
Expand Down Expand Up @@ -197,13 +196,6 @@ def repository_template(hacs):
yield dummy_repository_base(hacs, repository_obj)


@pytest.fixture
def repository_blueprint(hacs):
"""Fixtrue for HACS blueprint repository object"""
repository_obj = HacsBlueprintRepository(hacs, "test/test")
yield dummy_repository_base(hacs, repository_obj)


@pytest.fixture
def repository_appdaemon(hacs):
"""Fixtrue for HACS appdaemon repository object"""
Expand Down

0 comments on commit 8f0c7cf

Please sign in to comment.