Skip to content

Commit

Permalink
scripts: west_commands: add --ignore-venv-check option
Browse files Browse the repository at this point in the history
add --ignore-venv-check option to ignore the venv check.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
  • Loading branch information
maass-hamburg authored and kartben committed Jan 7, 2025
1 parent 86e9faa commit 9d0627a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/west_commands/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ def do_add_parser(self, parser_adder):
"'--dry-run' to pip not to actually install anything, but print what would be.",
)

pip_parser.add_argument(
"--ignore-venv-check",
action="store_true",
help="Ignore the virtual environment check. "
"This is useful when running 'west packages pip --install' "
"in a CI environment where the virtual environment is not set up.",
)

return parser

def do_run(self, args, unknown):
Expand Down Expand Up @@ -145,7 +153,7 @@ def do_run_pip(self, args, manager_args):
requirements += [Path(module.project) / r for r in pip.get("requirement-files", [])]

if args.install:
if not in_venv():
if not in_venv() and not args.ignore_venv_check:
self.die("Running pip install outside of a virtual environment")

if len(requirements) > 0:
Expand Down

0 comments on commit 9d0627a

Please sign in to comment.