@@ -31,10 +31,10 @@ def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtim
31
31
32
32
self .os_utils = OSUtils ()
33
33
34
- # Find the logical id of the function to be built.
35
34
options = kwargs .get ("options" ) or {}
36
- build_logical_id = options .get ("build_logical_id" , None )
35
+ build_in_source = kwargs .get ("build_in_source" )
37
36
37
+ build_logical_id = options .get ("build_logical_id" , None )
38
38
if not build_logical_id :
39
39
raise WorkflowFailedError (
40
40
workflow_name = self .NAME ,
@@ -44,12 +44,14 @@ def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtim
44
44
45
45
subprocess_make = SubProcessMake (make_exe = self .binaries ["make" ].binary_path , osutils = self .os_utils )
46
46
47
- build_in_source = kwargs .get ("build_in_source" )
48
47
# Don't build in source by default (backwards compatibility)
49
48
if build_in_source is None :
50
49
build_in_source = False
51
50
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
+ )
53
55
54
56
make_action = CustomMakeAction (
55
57
artifacts_dir ,
@@ -68,19 +70,11 @@ def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtim
68
70
69
71
self .actions .append (make_action )
70
72
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 ):
72
74
"""
73
- Gets the directory where the make action should be executed
75
+ Returns the directory where the make action should be executed
74
76
"""
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
84
78
85
79
def get_resolvers (self ):
86
80
return [PathResolver (runtime = "provided" , binary = "make" , executable_search_paths = self .executable_search_paths )]
0 commit comments