Skip to content

Commit

Permalink
Load customize.py before deps only in the case of cached scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunsuresh committed Nov 25, 2024
1 parent 6b1ad7f commit bafbc22
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions automation/script/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -1169,13 +1169,13 @@ def _run(self, i):
cached_path = ''

local_env_keys_from_meta = meta.get('local_env_keys', [])

# Check if has customize.py
path_to_customize_py = os.path.join(path, 'customize.py')
customize_code = None
customize_common_input = None
customize_common_input = {}

if os.path.isfile(path_to_customize_py):
if os.path.isfile(path_to_customize_py) and cache:
r = utils.load_python_module(
{'path': path, 'name': 'customize'})
if r['return'] > 0:
Expand Down Expand Up @@ -1647,7 +1647,24 @@ def _run(self, i):
'meta': meta,
'self': self
}
if customize_code:
if os.path.isfile(path_to_customize_py): #possible duplicate execution - needs fix
r = utils.load_python_module(
{'path': path, 'name': 'customize'})
if r['return'] > 0:
return r

customize_code = r['code']

customize_common_input = {
'input': i,
'automation': self,
'artifact': script_artifact,
'customize': script_artifact.meta.get('customize', {}),
'os_info': os_info,
'recursion_spaces': recursion_spaces,
'script_tags': script_tags,
'variation_tags': variation_tags
}
run_script_input['customize_code'] = customize_code
run_script_input['customize_common_input'] = customize_common_input

Expand Down

0 comments on commit bafbc22

Please sign in to comment.