Browse Source

scripts: west_commands: add --ignore-venv-check option

add --ignore-venv-check option to ignore the venv check.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
pull/83664/head
Fin Maaß 6 months ago committed by Benjamin Cabé
parent
commit
9d0627a4bc
  1. 10
      scripts/west_commands/packages.py

10
scripts/west_commands/packages.py

@ -95,6 +95,14 @@ class Packages(WestCommand): @@ -95,6 +95,14 @@ class Packages(WestCommand):
"'--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):
@ -145,7 +153,7 @@ class Packages(WestCommand): @@ -145,7 +153,7 @@ class Packages(WestCommand):
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:

Loading…
Cancel
Save