Skip to content

Commit a07f91a

Browse files
committed
bot: github: Add 'west_update_env' parameter to git config
When using a separate Python virtual environment for the project and AutoPTS, and the 'west' tool is not installed globally, the 'west update' command in update_repos fails because 'west' is not visible. The new 'west_update_env' parameter allows specifying a Python environment to activate before running 'west update', ensuring the command works in isolated setups. Example usage in config.py: z['git'] = { 'zephyr': { 'path': f'{HOME_PATH}/zephyrproject/zephyr', 'remote': 'origin', 'branch': 'main', 'stash_changes': True, 'update_repo': True, 'west_update': True, 'west_update_env': 'source {HOME_PATH}/zephyrproject/.venv/bin/activate', }, }
1 parent ee3dda5 commit a07f91a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

autopts/bot/common_features/github.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ def update_repos(project_path, git_config):
8585
repos_dict[repo] = repo_dict
8686

8787
if conf.get('west_update', False):
88-
bot.common.check_call(['west', 'update'], cwd=repo_path)
88+
env_cmd = conf.get('west_update_env', None)
89+
env_cmd = env_cmd.split() + ['&&'] if env_cmd else []
90+
bot.common.check_call(env_cmd + ['west', 'update'], cwd=repo_path)
8991

9092
if conf.get('rm_pycache', False):
9193
for p in pathlib.Path(repo_path).rglob('*.py[co]'):

0 commit comments

Comments
 (0)