add aliases to run vendored python and node from command line

You can then do './scripts/python -m venv /path/to/venv' to create
a virtual env based on the bundled Python, which can be handy if
you don't happen to have the appropriate version of Python installed
separately.
This commit is contained in:
Damien Elmes 2021-10-18 15:50:16 +10:00
parent 5e604df306
commit cbc358ff0b
3 changed files with 17 additions and 0 deletions

View File

@ -2,6 +2,15 @@ load("@rules_python//python:defs.bzl", "py_binary")
load("@py_deps//:requirements.bzl", "requirement") load("@py_deps//:requirements.bzl", "requirement")
load(":binary.bzl", "pip_binary") load(":binary.bzl", "pip_binary")
# e.g. bazel run python
alias(
name = "python",
actual = "@python//:python",
)
# e.g. bazel run python:pip
pip_binary(name = "pip")
pip_binary(name = "black") pip_binary(name = "black")
pip_binary(name = "isort") pip_binary(name = "isort")

3
scripts/python Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
bazel run python -- $*

View File

@ -29,3 +29,8 @@ alias(
name = "yarn", name = "yarn",
actual = "@nodejs//:yarn", actual = "@nodejs//:yarn",
) )
alias(
name = "node",
actual = "@nodejs//:node",
)