Skip to content

Commit

Permalink
Feat/adapt exceptions for poetry v2 (#39)
Browse files Browse the repository at this point in the history
* feat: Adapt exceptions for poetry version v2

* fix: Fixed indexes
  • Loading branch information
micmurawski authored Jan 6, 2025
1 parent f9526e1 commit bd01fa4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions poetry_plugin_lambda_build/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@

from cleo.io.io import IO
from packaging.utils import NormalizedName
from poetry.console.exceptions import GroupNotFound
from packaging.version import Version
from poetry.__version__ import __version__
from poetry.core.packages.project_package import ProjectPackage
from poetry.poetry import Poetry
from poetry.repositories.http_repository import HTTPRepository
from poetry_plugin_export.walker import get_project_dependency_packages

poetry_version = Version(__version__)

if poetry_version < Version("2.0.0"):
from poetry.console.exceptions import GroupNotFound as GroupNotFoundError
else:
from poetry.console.exceptions import GroupNotFoundError


class RequirementsExporter:
ALLOWED_HASH_ALGORITHMS = ("sha256", "sha384", "sha512")
Expand Down Expand Up @@ -55,7 +63,7 @@ def _validate_group_options(self, group_options: dict[str, set[str]]) -> None:
for opt in sorted(invalid_options[group])
)
message_parts.append(f"{group} (via {opts})")
raise GroupNotFound(f"Group(s) not found: {', '.join(message_parts)}")
raise GroupNotFoundError(f"Group(s) not found: {', '.join(message_parts)}")

@property
def activated_groups(self) -> set[str]:
Expand Down Expand Up @@ -188,7 +196,7 @@ def export(
content += "\n"

if indexes:
content = self.export_indexes() + "\n\n" + content
content = "\n".join(self.export_indexes()) + "\n\n" + content

return content

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "poetry-plugin-lambda-build"
version = "1.0.6"
version = "1.0.7"
description = "The plugin for poetry that allows you to build zip packages suited for serverless deployment like AWS Lambda, Google App Engine, Azure App Service, and more..."
authors = ["Michal Murawski <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit bd01fa4

Please sign in to comment.