Skip to content

Commit 3c92f1a

Browse files
committed
review feedback
1 parent 2c97475 commit 3c92f1a

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

aws_lambda_builders/workflows/custom_make/workflow.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtim
3131

3232
self.os_utils = OSUtils()
3333

34-
# Find the logical id of the function to be built.
3534
options = kwargs.get("options") or {}
36-
build_logical_id = options.get("build_logical_id", None)
35+
build_in_source = kwargs.get("build_in_source")
3736

37+
build_logical_id = options.get("build_logical_id", None)
3838
if not build_logical_id:
3939
raise WorkflowFailedError(
4040
workflow_name=self.NAME,
@@ -44,12 +44,14 @@ def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtim
4444

4545
subprocess_make = SubProcessMake(make_exe=self.binaries["make"].binary_path, osutils=self.os_utils)
4646

47-
build_in_source = kwargs.get("build_in_source")
4847
# Don't build in source by default (backwards compatibility)
4948
if build_in_source is None:
5049
build_in_source = False
5150

52-
working_directory = self._get_working_directory(options, source_dir, scratch_dir, build_in_source)
51+
# an explicitly definied working directory should take precedence
52+
working_directory = options.get("working_directory") or self._select_working_directory(
53+
source_dir, scratch_dir, build_in_source
54+
)
5355

5456
make_action = CustomMakeAction(
5557
artifacts_dir,
@@ -68,19 +70,11 @@ def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtim
6870

6971
self.actions.append(make_action)
7072

71-
def _get_working_directory(self, options: dict, source_dir: str, scratch_dir: str, build_in_source: bool):
73+
def _select_working_directory(self, source_dir: str, scratch_dir: str, build_in_source: bool):
7274
"""
73-
Gets the directory where the make action should be executed
75+
Returns the directory where the make action should be executed
7476
"""
75-
options_working_directory = options.get("working_directory")
76-
77-
# an explicitly definied working directory should take precedence
78-
if options_working_directory:
79-
return options_working_directory
80-
elif build_in_source:
81-
return source_dir
82-
else:
83-
return scratch_dir
77+
return source_dir if build_in_source else scratch_dir
8478

8579
def get_resolvers(self):
8680
return [PathResolver(runtime="provided", binary="make", executable_search_paths=self.executable_search_paths)]

0 commit comments

Comments
 (0)