From ef5489d168f38297195fc335ab69642e7f608dcf Mon Sep 17 00:00:00 2001 From: Wing Fung Lau <4760060+hawflau@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:07:46 -0800 Subject: [PATCH] fix --- samcli/lib/build/workflow_config.py | 5 ++++- samcli/lib/runtimes/base.py | 19 +------------------ tests/unit/lib/utils/test_architecture.py | 6 +++--- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/samcli/lib/build/workflow_config.py b/samcli/lib/build/workflow_config.py index f273560a60..9de79711fb 100644 --- a/samcli/lib/build/workflow_config.py +++ b/samcli/lib/build/workflow_config.py @@ -21,6 +21,7 @@ RUST_CARGO_LAMBDA_CONFIG, ) from samcli.lib.runtimes.base import ( + RuntimeDataMixin, Runtime, DeprecatedRuntime, Family, @@ -90,7 +91,9 @@ def get_selector( def get_layer_subfolder(build_workflow: str) -> str: - subfolders_by_runtime = layer_subfolder_mapping(list(Runtime) + list(DeprecatedRuntime)) + subfolders_by_runtime = layer_subfolder_mapping( + cast(List[RuntimeDataMixin], list(Runtime) + list(DeprecatedRuntime)) + ) # User is responsible for creating subfolder in these workflows subfolders_by_runtime["makefile"] = "" diff --git a/samcli/lib/runtimes/base.py b/samcli/lib/runtimes/base.py index e685a8d30e..8e9a7dae78 100644 --- a/samcli/lib/runtimes/base.py +++ b/samcli/lib/runtimes/base.py @@ -3,23 +3,7 @@ from dataclasses import dataclass, field from enum import Enum, unique from pathlib import Path -from typing import Dict, List, Optional, Tuple, cast, Callable - -from samcli.lib.build.workflows import ( - CONFIG, - PYTHON_PIP_CONFIG, - NODEJS_NPM_CONFIG, - RUBY_BUNDLER_CONFIG, - JAVA_GRADLE_CONFIG, - JAVA_KOTLIN_GRADLE_CONFIG, - JAVA_MAVEN_CONFIG, - DOTNET_CLIPACKAGE_CONFIG, - GO_MOD_CONFIG, - PROVIDED_MAKE_CONFIG, - NODEJS_NPM_ESBUILD_CONFIG, - RUST_CARGO_LAMBDA_CONFIG, -) - +from typing import Dict, List, Optional, Tuple, cast LOG = logging.getLogger(__name__) @@ -38,7 +22,6 @@ class Architecture(Enum): class FamilyDataMixin: key: str layer_subfolder: Optional[str] - workflow_config: Callable[[str, str], CONFIG] dep_manager: List[Tuple[str, Path]] = field(default_factory=list) # (package manager, path to local init template) build: bool = True eb_code_binding: Optional[str] = None # possible values are "Java8", "Python36", "Go1", "TypeScript3" diff --git a/tests/unit/lib/utils/test_architecture.py b/tests/unit/lib/utils/test_architecture.py index 1fefd5d700..1d314f186a 100644 --- a/tests/unit/lib/utils/test_architecture.py +++ b/tests/unit/lib/utils/test_architecture.py @@ -57,9 +57,9 @@ def test_must_pass_for_support_runtime_architecture(self, runtime, arch, package @parameterized.expand( [ - ("java8", ARM64), - ("go1.x", ARM64), - ("provided", ARM64), + ("java8", Architecture.ARM64.value), + ("go1.x", Architecture.ARM64.value), + ("provided", Architecture.ARM64.value), ] ) def test_must_raise_for_unsupported_runtime_architecture(self, runtime, arch):